메뉴 건너뛰기

목록
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 1310 1
1107 gitlab쓰지 마셈 15 다람쥐 2020.06.11 670 0
1106 Selenium alert_is_present 작동 원리 2 우지챠 2021.01.04 620 1
1105 Microsoft Visual Studio 2022를 사용하여 첫 번째 C++ Windows Form 만들기 9 file 저능아 2023.01.15 375 1
1104 해피해킹 프로2 type-s 사용기 8 file 다람쥐 2020.05.24 330 2
1103 성님들도 서버호스팅 하나 받으셈 14 file 머스크멜론 2021.02.24 329 0
1102 RAID5 순차쓰기 성능이 너무 낮음... 1 아메 2021.12.29 247 0
1101 오늘 한 프로젝트: 그래픽 광량 표현 12 file 우지챠 2021.01.05 245 8
1100 좆본 IT 취업 가이드 ~ 간략판 ~ 9 抱き枕 2020.07.22 243 6
1099 삭제된 게시글입니다. 노모현 2020.06.03 243 0
1098 정보) 수용서의 기본소양 1편, 짤검색에 대해서 araboji. 8 file 하루각하 2021.01.06 234 6
1097 키 마우스 매핑 프로그램 만들었음 10 file '`' 2022.08.30 206 6
1096 스프링에서 파일업로드 개발하는데 왤케 에러나냐 8 阿米娅 2020.08.12 197 0
1095 시발 리눅스 SSH서버 공개키로그인이 왜안되나 했는데 5 file 히마와리 2020.06.21 196 0
1094 콤퓨타 ㅍㅌㅊ? 11 file 문향 2020.05.19 191 -1
1093 대학생 때 세웠던 목표를 이뤘음 7 file 마루쉐 2021.09.14 188 10
1092 삭제된 게시글입니다. 스마일 2020.06.12 182 0
1091 본인 노트북 자랑해봄 4 file ハンター 2020.05.20 181 0
1090 삭제된 게시글입니다. 노모현 2020.05.30 173 0
1089 오늘자 리팩터링 9 file 마루쉐 2021.01.03 171 5
목록
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 56 Next
/ 56