메뉴 건너뛰기

목록
2021.10.11 17:25

합필갤 다운로더

profile
조회 수 99 댓글 3 예스잼 0 노잼 0

No Attached Image

import urllib3
import re
import os

def createFolder(directory):
    try:
        if not os.path.exists(directory):
            os.makedirs(directory)
    except OSError:
        print ('Error: Creating directory. ' +  directory)


def readXML():
    url = 'http://cfs.tistory.com/custom/blog/140/1407955/skin/images/list.xml'
    http = urllib3.PoolManager()
    response = http.request('GET', url)
    try:
        p = re.compile('\<annotation\>(.*)<\/annotation>(?:(?:\n|\s)+)\<location\>(.*)<\/location>')
        m = p.findall(response.data.decode("utf-8"))
        return m
    except:
        pass
    return None
def download(filename, url):
    path = './download'
    http = urllib3.PoolManager()
    response = http.request('GET', url, preload_content=False)
    createFolder('./download')
    with open(path + "/" + filename, 'wb') as out:
        while True:
            data = response.read(8196)
            if not data:
                break
            out.write(data)

    response.release_conn()

bucket = readXML()
if bucket != None:
    for each in bucket:
        filename = each[0]
        filename = filename.replace('#', '_')
        filename = filename.replace(':', '_')
        filename = filename.replace(';', '_')
        filename = filename.replace('\\', '_')
        filename = filename.replace('|', '_')
        filename = filename.replace('%', '_')
        filename = filename.replace('^', '_')
        filename = filename.replace('*', '_')
        filename = filename.replace('!', '_')
        filename = filename.replace('@', '_')
        filename = filename.replace('~', '_')
        filename = filename.replace('`', '_')
        filename = filename.replace('(', '_')
        filename = filename.replace(')', '_')
        filename = filename.replace('/', '_')
        url = each[1]
        try:
            download(filename + ".mp3", url)
        except:
            pass

 

급하게짬

여러 티스토리 블로그와 스택오버플로우 ctrl cv 조합임


List of Articles
번호 제목 글쓴이 날짜 조회 수 추천
공지 수용소닷컴 이용약관 file asuka 2020.05.16 1304 1
622 gate.io gate_api 보유자산조회, 호가조회, 매수 2 두시간 2021.09.30 41 0
621 뭐냐이거 2 file 바보 2021.10.01 43 0
620 아잇 씻팔 꼴받게하네 2 file 바보 2021.10.02 38 0
619 vmware에서 게임돌리기 2 머스크멜론 2021.10.02 62 0
618 아카라이브 다운로더 고장남 5 file 꼬북칩 2021.10.02 73 0
617 어플 하나 제작 4 MDR 2021.10.03 84 0
616 음악봇 터졌길래 2 file 바보 2021.10.03 95 0
615 mp3 다운받아서 하는거말고 9 file 바보 2021.10.03 91 0
614 파이썬 깔아봐야지 5 그리드 2021.10.06 77 0
613 하이쉿팔 2 file 바보 2021.10.07 74 0
612 음악봇 2 file 바보 2021.10.07 106 1
611 WEB3가 뭐임 2 그리드 2021.10.08 52 0
610 코린이 PyQt5 공부하고있어요 7 file 바보 2021.10.09 84 0
609 이번 연휴엔 닷넷 6.0 하기로 했는데 2 만년필 2021.10.10 72 0
608 vs가 용량 엄청 먹는구나 2 만년필 2021.10.10 75 0
» 합필갤 다운로더 3 머스크멜론 2021.10.11 99 0
606 Windows Terminal 이걸 왜 이제야 알았지 4 만년필 2021.10.11 81 0
605 클래스밖변수 따로 선언안하면 못쓰는줄알았는데 4 file 바보 2021.10.13 92 0
604 공부에 게을러지고 있음 1 그리드 2021.10.13 74 0
603 갑자기 궁금해진거 2 file 바보 2021.10.14 70 0
목록
Board Pagination Prev 1 ... 20 21 22 23 24 25 26 27 28 29 ... 56 Next
/ 56