메뉴 건너뛰기

목록
2021.10.11 17:25

합필갤 다운로더

profile
조회 수 100 댓글 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 1340 1
1017 삭제된 게시글입니다. midori 2022.01.12 101 0
1016 html 존나게 연습함 5 file 毛簿没区 2021.12.20 101 0
1015 삭제된 게시글입니다. 우지챠 2021.01.13 101 0
1014 삭제된 게시글입니다. 우지챠 2020.12.19 101 0
1013 삭제된 게시글입니다. 스마일 2020.07.29 101 0
1012 어도비 새끼들 제품 왜이렇게 비싸냐 3 file 毛簿没区 2022.01.11 100 0
1011 한국 아마존 서버에선 warning.or.kr가 뚫릴까? 4 file 으ㅇ유ㅏ」 2021.11.30 100 0
1010 else if 왜쓰는지 이제 이해했음 5 바보 2021.10.15 100 0
» 합필갤 다운로더 3 머스크멜론 2021.10.11 100 0
1008 C++ 20 새 기능들 file MDR 2020.10.01 100 0
1007 애자락 쓰면 안되는 이유 1 file shiho 2020.09.01 100 0
1006 -메- 64비트 도입여정 1 나무터칭수필맨 2023.06.10 99 0
1005 혹시 소프트웨어 기술자신고 등록해본 부타있음? file 阿米娅 2020.09.10 99 0
1004 Django 관련해서 질문 생김 8 헬반도씹조센노비 2020.06.24 99 0
1003 꺼토미 소스코드 보고있는데 1 midori 2021.12.05 98 1
1002 오라클 클라우드 자격증 개허벌이노 10 file 아메 2021.12.01 98 0
1001 GoodbyeDPI README 봤는데 얼탱이가 없네 ㅋㅋㅋㅋㅋㅋ 2 file MDR 2020.09.30 98 0
1000 관리자 페이지 만들고 관여 안하기 vs 관리자 페이지 안 만들기 2 file clownpepe 2020.08.03 98 0
999 삭제된 게시글입니다. 노모현 2020.05.22 98 0
998 어 형이야. 새우튀김 2023.08.11 97 0
목록
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 56 Next
/ 56