Socket
Socket
Sign inDemoInstall

naver-blog-backer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

naver-blog-backer

Backup your naver blog and Create backlink text file


Maintainers
1

naver-blog-backer

naver-blog-backer๋Š” ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ๋ฅผ ๋ฐฑ์—…(ํฌ๋กค๋ง)๊ณผ ๋ฐฑ๋งํฌ ๋‘ API๋ฅผ ์ œ๊ณตํ•˜๋Š” ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค.

  1. ๋ฐฑ์—…(crawling) API๋Š” ๊ฐœ์ธ ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ์˜ ๊ธ€์„ ์•„์นด์ด๋น™ ๋ชฉ์ ์œผ๋กœ ๊ธฐ์กด ํฌ์ŠคํŠธ๋ฅผ ๋งˆํฌ๋‹ค์šด์–ธ์–ด ํŒŒ์ผ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
  2. ๋ฐฑ๋งํฌ API๋Š” ๊ธฐ์กด ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ ์‚ฌ์šฉ์ž๋“ค์˜ ์• ๋กœ์‚ฌํ•ญ์ธ ๊ตฌ๊ธ€ ๊ฒ€์ƒ‰ ์—”์ง„์— ํฌ์ŠคํŠธ๊ฐ€ ์ธ๋ฑ์‹ฑ ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ํฌ์ŠคํŠธ ๋ฐฑ๋งํฌ ํ…์ŠคํŠธ ํŒŒ์ผ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

โ€ป ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž๋ถ„๋“ค๊ป˜์„œ๋Š” ํ•ด๋‹น ํด๋” ๋‚ด์— ์œ„์น˜ํ•œ 'naverblogbacker.exe'ํŒŒ์ผ์„ ๋‹ค์šด ๋ฐ›์œผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
๋ณธ๋ž˜ ์ž„์˜์˜ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰์‹œํ‚ค๋Š” ๊ฒƒ์€ ํ•ดํ‚น ์ทจ์•ฝํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์šด๋กœ๋“œ ์‹œ ๋ฐฑ์‹  ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ window defense์— ๊ฒ€์ถœ๋  ์ˆ˜ ์žˆ์œผ๋‚˜ ์•ˆ์‹ฌํ•˜์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค :smile:

โ€ป ํ•ด๋‹น ํŒจํ‚ค์ง€๋Š” ์•„๋ž˜์˜ ๋‘ ํŒจํ‚ค์ง€๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ๋งŒ๋“ค์–ด์กŒ์Šต๋‹ˆ๋‹ค.

  1. https://github.com/Lenir/Naver-Blog-Backup
  2. https://github.com/chandong83/download-naver-blog

Installation

$ pip install naver-blog-backer

Usage

naverblogbacker๋Š” crawling๊ณผ backlinking 2๊ฐ€์ง€ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

  1. crawling use case
    from naverblogbacker.utils import isEmptyDirectory
    from naverblogbacker.blog import BlogCrawler
    import os

    myId = 'YOUR NAVER ID' 
    myPath = 'SAVE DIRECTROY PATH'
    mySkipSticker = 'TRUE OR FALSE'

    if isEmptyDirectory(dirPath=myPath):

        myBlog = BlogCrawler(targetId=myId, skipSticker=mySkipSticker, isDevMode=False)
        myBlog.crawling(dirPath=myPath)

        # ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰ ์‹œ ๋ฐฑ์—… ํ›„ ์—๋Ÿฌ ํฌ์ŠคํŠธ ๊ฐœ์ˆ˜๊ฐ€ ์ถœ๋ ฅ
        print(f'[MESSAGE] Complete! your blog posts, the number of error posts is {BlogCrawler.errorPost}')
        # ์œ„์˜ ๋ฉ”์„ธ์ง€๋ฅผ ์ž˜ ๋ณด๊ธฐ ์œ„ํ•ด ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ ์ „ ์ •์ง€
        os.system("pause")

โ€ป SAVE DIRECTORY PATH๋Š” ๋ฐ˜๋“œ์‹œ ๋นˆ ํด๋”์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด, ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ํ”„๋กœ๊ทธ๋žจ์ด ์ข…๋ฃŒ๋ฉ๋‹ˆ๋‹ค.

output

  1. backlink use case
    from naverblogbacker.blog import BlogCrawler
    import os

    myId = 'YOUR NAVER ID' 
    myPath = 'SAVE DIRECTROY PATH'

    myBlog = BlogCrawler(targetId=myId, skipSticker=mySkipSticker, isDevMode=False)
    myBlog.backlinking(dirPath=myPath)

    # ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰ ์‹œ ๋ฐฑ์—… ํ›„ ์—๋Ÿฌ ํฌ์ŠคํŠธ ๊ฐœ์ˆ˜๊ฐ€ ์ถœ๋ ฅ
    print(f' [MESSAGE] Complete! created your backlinks')
    # ์œ„์˜ ๋ฉ”์„ธ์ง€๋ฅผ ์ž˜ ๋ณด๊ธฐ ์œ„ํ•ด ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ ์ „ ์ •์ง€
    os.system("pause")

โ€ป ๋ฐฑ๋งํฌ ์ƒ์„ฑ api๋Š” ๋ฐ˜๋“œ์‹œ ๋นˆ ํด๋”์ผ ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.

output

Options

  • targetId: ๋ฐฑ์—… ๋ฐ ๋ฐฑ๋งํฌ๋ฅผ ์œ„ํ•œ ์‚ฌ์šฉํ•  ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ ์•„์ด๋””์ž…๋‹ˆ๋‹ค.
  • dirPath: ๋ฐฑ์—… ํ˜น์€ ๋ฐฑ๋งํฌ ๊ฒฐ๊ณผ๋ฌผ์„ ์ €์žฅํ•  ๊ฒฝ๋กœ์ž…๋‹ˆ๋‹ค.
  • skipSticker : (optional) ๋ธ”๋กœ๊ทธ ํฌ์ŠคํŠธ ๋‚ด ์Šคํ‹ฐ์ปค ์ด๋ฏธ์ง€๋ฅผ ์ €์žฅํ• ์ง€ ๋ง์ง€์— ๋Œ€ํ•œ ์˜ต์…˜์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ True์ด๋ฉฐ, True๋ฅผ ์Šคํ‹ฐ์ปค ์ด๋ฏธ์ง€๋ฅผ ์Šคํ‚ตํ•ด ์ €์žฅํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์„ ๋œปํ•ฉ๋‹ˆ๋‹ค.
  • isDevMode: (optional) naver-blog-backer ๋ชจ๋“ˆ ๋‚ด ์ฒ˜๋ฆฌ๋“ค์— ๋Œ€ํ•œ ์ƒ์„ธ ํžˆ์Šคํ† ๋ฆฌ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๊ฐœ๋ฐœ์ž ๋ชจ๋“œ ์˜ต์…˜์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ False์ด๋ฉฐ, ๋งŒ์•ฝ True๋กœ ์ „ํ™˜ ์‹œ [DEV MODE] ๋ฉ”์„ธ์ง€๊ฐ€ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

Examples

  1. using pthon script (the code is tests folder in this repository)
import os
from naverblogbacker.utils import isEmptyDirectory
from naverblogbacker.blog import BlogCrawler
from pick import pick


def main(myId, myPath, myOption):
    if myOption is 'backlink':
        try:
            myBlog = BlogCrawler(targetId=myId, skipSticker=True, isDevMode=False)
            myBlog.backlinking(dirPath=myPath)
            print(f' [MESSAGE] Complete! created your backlinks')
            os.system("pause")

        except Exception as e:
            print(e)
            os.system("pause")

    elif myOption is 'backup':
        try:
            if not isEmptyDirectory(dirPath=myPath):
                pass

            myBlog = BlogCrawler(targetId=myId, skipSticker=True, isDevMode=False)
            myBlog.crawling(dirPath=myPath)
            print(f'[MESSAGE] Complete! your blog posts, the number of error posts is {BlogCrawler.errorPost}')
            os.system("pause")

        except Exception as e:
            print(e)
            os.system("pause")

    else:
        print(f' [MESSAGE] Sorry, It`s currently not supported')
        os.system("pause")

if __name__ == '__main__':
    myId = 'YOUR NAVER ID'
    myPath = 'SAVE DIRECTORY'
    myOption =  'CHOOSE OPTIONS IN [backlink, backup]'

    main(myId, myPath, myOption)

sample

  1. using program (the program, naverblogbacker.exe, is root path in this repository)

sample

Notes

Notations

ํ˜„์žฌ ์ด ํŒจํ‚ค์ง€๋Š” ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ ์—๋””ํ„ฐ ๋ฒ„์ ผ 4๋งŒ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. (์Šค๋งˆํŠธ ์—๋””ํ„ฐ one) ๋งŒ์•ฝ ๋ฐฑ์—…ํ•  ์ˆ˜ ์—†๋Š” ๋ฒ„์ ผ์˜ ํฌ์ŠคํŠธ๋ฅผ ๋งˆ์ฃผํ•˜๊ฒŒ ๋˜๋ฉด ์ž๋™์œผ๋กœ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค.

Version Information
ver 0.0.1 ~ 0.0.6

Test bed

ver 0.0.7

EXE packing

ver 0.0.8

Add authentication & GUI version serving

Later

it will be making GUI version for common users


Memo

ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋ฐ ํ”„๋กœ๊ทธ๋žจ ๊ฐœ๋ฐœ๊ณผ ๊ด€๋ จ๋œ ๋ฉ”๋ชจ๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ„์ž…๋‹ˆ๋‹ค.

package things
  • code stype : cameCase

  • package component python script file

    1. blog.py
    2. componentParser.py
    3. post.py
    4. utils.py
  • how it works?

    1. Collect specific blog's posts as a list by requesting naver blog api.

    2. In one post item, Bring the inframe data with bs4 package by using BlogPost class

    3. If it get inframe data, one component would be parsing and saving data while for loop

    4. In the end of for loop, it make full text data into one file. And then save it with its assets like imags, video.

    5. Repeats steps 2 to 4 until counting post list length

Naver blog editior things

์ง€์›ํ•˜๋Š” ์—๋””ํ„ฐ ๋ฒ„์ ผ์˜ Component ๊ตฌ์„ฑ์€ ํฌ๊ฒŒ HEADER์™€ CONTENT๋กœ ๋‚˜๋‰ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋ชจ๋“  ์ปจํ…์ธ ๋Š” <div class="se-component"></div>๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

  • HEADER

    • ์นดํ…Œ๊ณ ๋ฆฌ๋ช… : se-component & se-documentTitle > se-component-content > ... > blog2_series
    • ์ œ๋ชฉ : se-component se-documentTitle > se-component-content > ... > se-title-text
  • CONTENT

    • ํ…์ŠคํŠธ ์ปดํฌ๋„ŒํŠธ(se-component & se-text)

      • ์ผ๋ฐ˜ ํ…์ŠคํŠธ : se-component & se-text > se-component-content > se-section-text > se-module-text > p.se-text-paragraph & span

      • ๊ณต๋ฐฑ ํ…์ŠคํŠธ : se-component & se-text > se-component-content > se-section-text > se-module-text > p.se-text-paragraph & span (nothing)

      • ๋งํฌ ํ…์ŠคํŠธ : se-component & se-text > se-component-content > se-section-text > se-module-text > p.se-text-paragraph & se-link

      • ํ•ด์‹œํƒœ๊ทธ ํ…์ŠคํŠธ : se-component & se-text > se-component-content > ... > se-module-text > se-text-paragraph > __se-hash-tag

    • ์†Œ์ œ๋ชฉ ์ปดํฌ๋„ŒํŠธ(se-component & se-sectionTitle)

      • ์†Œ์ œ๋ชฉ ํ…์ŠคํŠธ : se-component & se-sectionTitle > se-component-content > ... > se-module-text > se-text-paragraph
    • ์ธ์šฉ๊ตฌ ์ปดํฌ๋„ŒํŠธ(se-component & se-quotation)

      • ์ธ์šฉ๊ตฌ ํ…์ŠคํŠธ : se-component & se-quotation > se-component-content > ... > se-module-text > se-text-paragraph
    • ๊ตฌ๋ถ„์„  ์ปดํฌ๋„ŒํŠธ(se-component & se-horizontalLine)

      • ๊ตฌ๋ถ„์„  : se-component & se-horizontalLine > se-component-content > se-section-horizontalLine > se-module-horizontalLIne > ... > hr.se-hr (์Šคํƒ€์ผ์— ๋”ฐ๋ผ ๋ณ€ํ•˜์ง€๋Š” ์•Š์Œ)
    • ์ผ์ • ์ปดํฌ๋„ŒํŠธ(se-component & se-schedule) โ€ป ์ง€์›ํ•˜์ง€ ์•Š์Œ

      • ์ผ์ • ํ…์ŠคํŠธ : se-component & se-schedule > se-component-content > se-section-schedule > se-module-schedule > ... > p.se-schedule-title
      • ์ผ์ • ๋ฐ์ดํŠธ : se-component & se-schedule > script[data-module] > data.startAt, data.endAt
    • ์ฝ”๋“œ ์ปดํฌ๋„ŒํŠธ(se-component & se-code)

      • ์†Œ์Šค ์ฝ”๋“œ : se-component & se-code > se-component-content > se-section-code > se-section-code > se-module-code > se-code-source
    • ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(์ฑ…, ์˜ํ™”) ์ปดํฌ๋„ŒํŠธ(se-component & se-material)

      • ๋งํฌ ๋ฐ์ดํ„ฐ : se-component & se-material > se-component-content > se-section-material > a[data-linkdata]
    • ์ด๋ฏธ์ง€ ์ปดํฌ๋„ŒํŠธ(se-component & se-image)

      • ์ด๋ฏธ์ง€ ์†Œ์Šค : se-component & se-image > se-component-content > se-section-image > se-module-image > a[data-link, src] or a > img[data-lazy-src]
      • ์ด๋ฏธ์ง€ ํ…์ŠคํŠธ : se-component & se-image > se-component-content > se-section-image > se-module-text & se-caption > p.se-text-paragraph > span
    • ์Šคํ‹ฐ์ปค ์ปดํฌ๋„ŒํŠธ(se-component & se-sticker)

      • ์ด๋ฏธ์ง€ ์†Œ์Šค : se-component & se-sticker > se-component-content > se-section-sticker > se-module-sticker > a > img.se-sticker-image[src]
      • ์ด๋ฏธ์ง€ ํ…์ŠคํŠธ : se-component & se-sticker > se-component-content > se-section-sticker > se-module-text & se-caption > p.se-text-paragraph > span
    • ๋น„๋””์˜ค ์ปดํฌ๋„ŒํŠธ(se-component & se-video)

      • ๋น„๋””์˜ค ์ปดํฌ๋„ŒํŠธ : se-component & se-video > se-component-content > se-section-video
      • ๋น„๋””์˜ค ์†Œ์Šค : se-component & se-video > script > data-module (vid, inkey)
        1. api ์š”์ฒญ(https://apis.naver.com/rmcnmv/rmcnmv/vod/play/v2.0/vid=?inkey=?)
        2. json ํŽ˜์ด์ง€ ๋‚ด ์ €์žฅ URL ์œ„์น˜
    • ํŒŒ์ผ ์ปดํฌ๋„ŒํŠธ(se-component & se-file)

      • ํŒŒ์ผ ๋ฐ์ดํ„ฐ : se-component & se-file > se-component-content > se-section-file > se-module-file > a[data-link]
        1. link๋กœ api ์š”์ฒญ
    • ์ง€๋„ ์ปดํฌ๋„ŒํŠธ(se-component & se-placeMap) โ€ป ์ง€์›ํ•˜์ง€ ์•Š์Œ

      • ์ง€๋„ ๋ฐ์ดํ„ฐ : se-component & se-placeMap > se-component-content > se-section-placeMap > se-module-text > a.se-map-info > se-map-title & se-map-address
    • ์ž„๋ฒ ๋””๋“œ ์ปดํฌ๋„ŒํŠธ(se-component se-oembed)

      • ๋น„๋””์˜ค ๋ฐ์ดํ„ฐ : ... > content['data-module']
        • ๋น„๋””์˜ค URL
        • ๋น„๋””์˜ค ์ œ๋ชฉ
        • ๋น„๋””์˜ค ์ธ๋„ค์ผ URL
        • ๋น„๋””์˜ค description

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc