def WebToonSearch(): while True: try: kWord = str(input("검색할 만화 이름을 입력하세요. (exit 입력하면 검색종료) : ")).replace(' ', '') if kWord.lower() == 'exit': ClearWindow(); break sPage = int(input("몇쪽까지 검색할까요? (0을 입력하면 검색종료) : ")) if sPage == 0: ClearWindow(); break for i in range(1, sPage+1): soup = FastGetSoup(f"{baseURL}/search.nhn?m=webtoon&keyword={kWord}&type=title&page={i}") rContainer = soup.find('ul', {'class':'resultList'}).find_all('h5') if rContainer == []: PrintInfo("검색 결과가 없습니다.") break else: PrintInfo(f"{i}페이지 검색 결과입니다.") for j in rContainer: wTitle = j.a.text wLink = baseURL + j.a['href'] print('-'*80) print("제목 : ", wTitle) print("링크 : ", wLink) print('-'*80, '\n') except ( TypeError, KeyboardInterrupt, EOFError, UnboundLocalError): ClearWindow() PrintInfo("다시 입력해주세요.")
def main(): CheckInternet() ClearWindow() while True: try: PrintBanner() select = int( input( '\n1. 동인지 찾기' '\n2. 동인지 다운로드' '\n3. 뒤로 가기' '\n\n>> ' ) ) if select == 1: hSearch() elif select == 2: hDownload() elif select == 3: ClearWindow() break else: ClearWindow() PrintInfo('다시 선택해주세요.') except ( ValueError, KeyboardInterrupt, EOFError, NameError ): ClearWindow() PrintInfo('다시 선택해주세요.')
def hDownload(): while True: try: mLink = str(input("다운로드할 동인지의 링크를 입력하세요. (exit 입력하면 다운로드 종료) : ")).replace(' ', '') if mLink == 'exit': ClearWindow() return elif not baseURL+'/reader/' in mLink: ClearWindow() PrintInfo("잘못된 URL입니다."); continue else: ClearWindow() gNumber = sub('[^0-9]', '', mLink) Canceled = False imgLoc = [] dirLoc = f'./{gNumber}/' imgURLs = GetIMGsURL(gNum=gNumber) info = GetGalleryInfo(gNum=gNumber) print(info[1]) MakeDirectory(dirLoc) for imgs in enumerate(imgURLs): try: PrintProgressBar(imgs[0], len(imgURLs), prefix=f'{infoBanner}', suffix=f'({imgs[0]}/{len(imgURLs)})') fname = f"{gNumber}_{imgs[0]+1}.jpg" imgName = f"{dirLoc}{fname}" FastDownload(fname, imgs[1]) imgLoc.append(imgName) except ( KeyboardInterrupt, EOFError ): Canceled = True break ClearWindow() chdir('../') if Canceled == False: pdfName = GetFileName(info[0]) + '.pdf' MakePDF(imgLoc, pdfName, dirLoc) PrintInfo(f"\"./{pdfName}\" 에 저장되었습니다.\n") else: rmtree(dirLoc, ignore_errors=True) PrintInfo('다운로드가 취소되었습니다.') break except ( KeyboardInterrupt, EOFError ): PrintInfo("다시 입력해주세요.")
def mSearch(): while True: try: keyWord = str(input("검색어를 입력하세요. (exit을 입력하면 검색종료): ")).replace( ' ', '') if keyWord.lower() == 'exit': break searchURL = f"{baseURL}/bbs/search.php?url=%2Fbbs%2Fsearch.php&stx={keyWord}" lstContainer = FastGetSoup(searchURL).find('div', { 'class': 'search-media' }).find_all('div', {'class': 'media-heading'}) if lstContainer == []: print("검색결과가 없습니다.") else: print("\n") for lstC in lstContainer: mTitle = lstC.a.text.strip() mLink = lstC.a['href'] print('-' * 80) print("제목 : ", mTitle) print("링크 : ", baseURL + "/bbs/" + mLink) print('-' * 80, '\n') except (ValueError, EOFError, KeyboardInterrupt, NameError, UnboundLocalError): ClearWindow() PrintInfo("다시 입력해주세요.")
def PixivDownload(): while True: try: select = int( input('\n1. 작품 링크로 다운로드' '\n2. 작품 태그로 다운로드' '\n3. 뒤로 가기' '\n\n>> ')) if select == 1: try: print("\n',' 로 작품 구분합니다.\n") artLinkList = str( input('다운로드 할 작품의 Pixiv 작품 링크를 입력하세요. : ')).split(',') artIDs = [sub('[\D]', '', i) for i in artLinkList] IMGsDownload(artIdList=artIDs) except (KeyboardInterrupt, EOFError): ClearWindow() break elif select == 2: try: artTag = str(input('다운로드할 작품의 태그를 입력하세요. : ')) artPage = int(input('몇 페이지 가량 다운로드 할까요? : ')) for p in range(artPage): tags = FindTAGs(artTag, artPage) artIDs = [sub('\D', '', tags[t]) for t in tags] IMGsDownload(artIdList=artIDs) except (UnboundLocalError, TypeError, KeyboardInterrupt, EOFError): PrintInfo("다시 입력해주세요.") elif select == 3: ClearWindow() break else: PrintInfo("다시 선택해주세요.") except (KeyboardInterrupt, EOFError): ClearWindow() return except (TypeError): PrintInfo("다시 선택해주세요.")
def hSearch(): while True: try: print("검색방법>> 검색어1 | 태그:태그이름 | 검색어2") print("'|' 로 태그 및 검색어 구분합니다.\n") kWord = str(input("\n검색할 동인지 이름을 입력하세요. (exit 입력하면 검색종료) : ")).replace(' ', '') if kWord.lower() == 'exit': ClearWindow(); break page = 1 morePage = True while True: ClearWindow() soup = FastGetSoup(f"https://hiyobi.me/search/{kWord}/{page}") mainContainer = soup.find('main', {'class':'container'}).find_all('h5') if mainContainer == []: PrintInfo("검색 결과가 없습니다.") break else: PrintInfo(f"{page}페이지 검색 결과입니다.") for j in mainContainer: dTitle = j.a.text dLink = j.a['href'] print('-'*80) print("제목 : ", dTitle) print("링크 : ", dLink) print('-'*80, '\n') PrintInfo("이전페이지: 아래 방향키, 다음 페이지: 위 방향키, 검색종료: Esc키") while True: try: rk = read_key() if rk == 'down': if page-1 != 0: page -= 1 else: PrintInfo("첫 페이지 입니다.") continue if rk == 'up': page += 1 if rk == 'esc': morePage = False if rk in ['down', 'up', 'esc']: break except ( KeyboardInterrupt, EOFError ): pass if morePage == False: ClearWindow() break except ( TypeError, KeyboardInterrupt, EOFError, UnboundLocalError): ClearWindow() PrintInfo("다시 입력해주세요.")
def mDownload(): while True: try: maruLink = str( input('다운로드 할 마나모아 만화 링크를 입력하세요. (exit을 입력하면 다운로드 종료): ')) if maruLink.replace(' ', '') == 'exit': break PrintInfo("횟차를 불러오는 중입니다...") soup = FastGetSoup(maruLink) chapterList = list(soup.find_all('td', {'class': 'list-subject'})) chapterList.reverse() bigTitle = soup.title.text.replace('MARUMARU - 마루마루 - ', '') epiList = [] for ch in chapterList: epiTitle = sub('[\t]', '', ch.a.text.strip()) epiLink = ch.a['href'] if not 'marumaru' in epiLink: epiLink = baseURL + epiLink epiList.append([epiTitle, epiLink]) print() for epi in enumerate(epiList): print("-" * 80, f"\n{epi[0]+1}. {epi[1][0]}") print("-" * 80, '\n') sIndex = str( input(""" 다운로드 받고 싶은 횟차를 입력하세요. (exit 입력하면 다운로드 종료) (사용법) 1화 ~ 10화, 12화 모두 다운로드 : 1~10, 12 : """)).replace(' ', '').split(',') if sIndex == 'exit': break episode = [] for e in sIndex: if '~' in e: s = e.split('~') s1 = int(s[0]) s2 = int(s[1]) if s1 <= s2: InDe = 1 else: InDe = -1 section = list(range(int(s[0]), int(s[1]) + InDe, InDe)) else: section = [int(e)] for sec in section: if sec <= 0: section.remove(sec) episode.extend(section) FinalInfo = "" Canceled = False for epi in episode: try: mTitle = epiList[epi - 1][0] mLink = epiList[epi - 1][1] except (IndexError): PrintInfo(f"{epi}화는 잘못된 횟차 수 입니다.") break mangaIMGURL = GetImageURLs(mangaAddr=mLink) filename = GetFileName(mTitle) dirLoc = f"./marumaru_temp/" imgLoc = [] ClearWindow() print(f'\n제목 : {bigTitle}' + f'\n\n횟차 : {epi}화\n') MakeDirectory(dirLoc) for imgs in enumerate(mangaIMGURL): try: PrintProgressBar( imgs[0], len(mangaIMGURL), prefix=f'{infoBanner}', suffix=f'({imgs[0]}/{len(mangaIMGURL)})') jpgName = f"{imgs[0]+1}.jpg" imgName = f"{dirLoc}{jpgName}" FastDownload(jpgName, imgs[1]) imgLoc.append(imgName) except (KeyboardInterrupt, EOFError): Canceled = True break ClearWindow() chdir('../') if Canceled == False: pdfName = filename + '.pdf' MakePDF(ImageList=imgLoc, Filename=pdfName, DirLoc=dirLoc) FinalInfo += f"{infoBanner} \"./{pdfName}\" 에 저장되었습니다.\n" else: PrintInfo('다운로드가 취소되었습니다.') break if Canceled == True: PrintInfo('다운로드가 취소되었습니다.') break print() if FinalInfo.replace(' ', '') != "": print(FinalInfo, '\n') except (KeyboardInterrupt, EOFError): PrintInfo('다시 선택해주세요.')
/_/ |_/_____/_/ |_| KDR-통합다운로더 ''') def InitPool(): signal(SIGINT, SIG_IGN) if __name__ == "__main__": freeze_support() if cpu_count() == 1: Pool(1, InitPool) else: Pool(cpu_count() - 1, InitPool) ClearWindow() PrintBanner() while True: try: PrintInfo("종료하려면 Ctrl+C 를 누르세요.") select = int( input('\n1. E-Hentai 다운로더 ' '\n2. Hiyobi 다운로더 ' '\n3. Marumaru 다운로더 ' '\n4. NaverWebtoon 다운로더 ' '\n5. Syosetu 다운로더 ' '\n6. Toonkor 다운로더 ' '\n7. Pixiv 다운로더 ' '\n\n>> ')) if 0 < select < len(DownloaderLIST) + 1:
def Download(): while True: while True: gLink = str( input("다운로드할 갤러리의 링크를 입력하세요. (exit 입력하면 다운로드 종료) : ")).replace( ' ', '') if gLink == 'exit': ClearWindow() return elif not gAddress in gLink: ClearWindow() PrintInfo('잘못된 URL 입니다.') break else: gNumber = gLink.split('/')[4] fType = str( input("저장할 파일 형태를 입력하세요. (zip 또는 pdf 입력, 기본값은 zip) : ") ).replace(' ', '') if fType != "pdf": fType = "zip" if gLink == 'exit': ClearWindow() break if gAddress in gLink: PrintInfo('이미지 주소를 불러오는중입니다.') gallInfo = [] imgList = [] c = 0 Canceled = False pSoup = FastGetSoup(gLink) try: gTitle = pSoup.find('h1', {'id': 'gn'}).text gInfo = pSoup.find('div', {'id': 'gd3'}) gAuthor = gInfo.find('div', { 'id': 'gdn' }).find('a').text gType = gInfo.find('div', {'id': 'gdc'}).text gallInfo.append(gTitle) gallInfo.append(gAuthor) gallInfo.append(gType) gPostInfo = gInfo.find('div', { 'id': 'gdd' }).find_all('tr') for i in range(len(gPostInfo)): gallInfo.append( gPostInfo[i].find_all('td')[1].text) except AttributeError: ClearWindow() PrintInfo("다운로드가 중지되었습니다.") break gInfoString = "\n" gInfoString += ("제목 : " + gallInfo[0] + "\n\n" "업로더 : " + gallInfo[1] + "\n\n" "종류 : " + gallInfo[2] + "\n\n" "날짜 : " + gallInfo[3] + "\n\n" "파일 크기 : " + gallInfo[7] + "\n\n" "페이지 수 : " + gallInfo[8] + "\n\n") getPage = pSoup.find('table').find_all( 'td', {'class': 'gdt2'})[5].text pageCount = int(sub('[pages]', '', getPage)) dirName = gNumber filename = sub('[\/:*?"<>|]', '_', gTitle) try: mkdir('{}'.format(dirName)) except FileExistsError: rmtree('{}'.format(dirName), ignore_errors=True) mkdir('{}'.format(dirName)) finally: try: chdir('{}'.format(dirName)) except PermissionError: pass pages = (pageCount // 40) + 1 iURLlist = [] for i in range(pages): url = gLink + "/?p={}".format(i) soup = FastGetSoup(url) imageURL = soup.find('div', { 'id': 'gdt' }).find_all('a') threadList = [] t = Thread(target=AppendURLs, args=( imageURL, iURLlist, )) t.setDaemon(False) t.start() threadList.append(t) for thr in threadList: if thr.is_alive(): thr.join() t._stop() ClearWindow() print(gInfoString) for i in iURLlist: try: jpgFile = '{}.jpg'.format(c + 1) jpgLoc = './{}/{}'.format(gNumber, jpgFile) PrintProgressBar(c, len(iURLlist), prefix='[E-hentai Downloader]', suffix=f"({c}/{len(iURLlist)})") FastDownload(jpgFile, i) imgList.append(jpgLoc) c += 1 except (KeyboardInterrupt, EOFError): Canceled = True break ClearWindow() chdir('../') if Canceled == False: fileLocation = "./{}.{}".format(filename, fType) if fType == 'zip': MakeZIP(dirName, fileLocation) PrintInfo("\"{}\" 에 저장되었습니다.".format(fileLocation)) if fType == 'pdf': MakePDF(imgList, fileLocation, dirName) PrintInfo("\"{}\" 에 저장되었습니다.".format(fileLocation)) else: PrintInfo("다운로드가 중지되었습니다.") rmtree('./{}/'.format(dirName), ignore_errors=True)
def Search(): while True: try: sSelect = int( input('\n1. 페이지로 찾기' '\n2. 검색어로 찾기' '\n3. 뒤로 가기' '\n\n검색할 방법을 선택하세요. : ')) if sSelect == 1: while True: try: page = int( input('검색할 페이지 번호를 입력하세요. (0을 입력하면 검색종료) : ')) if page <= 0: ClearWindow() break ClearWindow() url = "https://e-hentai.org/?page={}".format(page - 1) soup = FastGetSoup(url) Gallery = soup.find('table', { 'class': 'itg gltc' }).find_all('tr') PrintInfo("{}페이지의 검색 결과입니다.".format(page)) print("=" * 30) for g in Gallery: try: td = g.find_all('td')[2] title = td.find('div', {'class': 'glink'}).text link = td.find('a')['href'] print('\n제목 : {}'.format(title)) print('링크 : {}\n'.format(link)) except (IndexError, AttributeError, TypeError): pass print("\n" + "=" * 30 + "\n") except (ValueError, EOFError, KeyboardInterrupt, UnboundLocalError, NameError): ClearWindow() PrintInfo('다시 입력해주세요.') elif sSelect == 2: while True: try: sWord = str(input("검색어를 입력하세요. (exit 입력하면 검색종료) : ")) if sWord.replace(' ', '') == 'exit': ClearWindow() break sPage = 0 morePage = True ClearWindow() while True: url = "https://e-hentai.org/?page={}&f_search={}".format( sPage, sWord) soup = FastGetSoup(url) try: tr = soup.find('table', { 'class': 'itg gltc' }).find_all('tr') except AttributeError: PrintInfo("검색 결과가 없습니다.") print("\n" + "=" * 30) for t in tr: if "No unfiltered results in this page range. You either requested an invalid page or used too aggressive filters." in t.text: PrintInfo("모두 검색했습니다.") break td = t.find_all('td', {'class': 'gl3c glname'}) for info in td: title = info.find('div', { 'class': 'glink' }).text link = info.find('a')['href'] print('\n제목 : {}'.format(title)) print('링크 : {}\n'.format(link)) PrintInfo( "이전페이지: 아래 방향키, 다음 페이지: 위 방향키, 검색종료: Esc키") while True: try: rk = read_key() if rk == 'down': if sPage - 1 != -1: sPage -= 1 else: PrintInfo("첫 페이지 입니다.") continue if rk == 'up': sPage += 1 if rk == 'esc': morePage = False if rk in ['down', 'up', 'esc']: break except (KeyboardInterrupt, EOFError): pass if morePage == False: ClearWindow() break except (ValueError, EOFError, KeyboardInterrupt, UnboundLocalError, NameError): ClearWindow() PrintInfo('다시 입력해주세요.') elif sSelect == 3: ClearWindow() break else: ClearWindow() PrintInfo('다시 입력해주세요.') except (ValueError, EOFError, KeyboardInterrupt, NameError): ClearWindow() PrintInfo('다시 입력해주세요.')
def WebToonDownload(): while True: while True: try: wLink = str(input("다운로드할 웹툰의 링크를 입력하세요. (exit 입력하면 다운로드 종료) : ")).replace(' ', '') if wLink.lower() == 'exit': ClearWindow() return elif not baseURL+'/webtoon/list.nhn?titleId=' in wLink: ClearWindow() PrintInfo("잘못된 URL입니다."); break else: soup = FastGetSoup(wLink) epiCount = int(str(soup.find('td', {'class':'title'}).a['onclick']).split("\'")[-2]) pageCount = (epiCount // 10) + 1 epiList = [] for i in range(1, pageCount+1, 1): wtEpis = FastGetSoup(wLink + f'&page={i}').find_all('td', {'class':'title'}) for w in wtEpis: epiList.append([w.a.text, baseURL + w.a['href']]) print() epiList.reverse() for epi in enumerate(epiList): print("-"*80, f"\n{epi[0]+1}. {epi[1][0]}") print("-"*80, '\n') wtInfo = soup.find('div', {'class':'comicinfo'}) wAuthor = wtInfo.find('span', {'class':'wrt_nm'}).text.strip() wTitle = wtInfo.find('img')['title'] wIntro = wtInfo.find('p').text.strip() wGenre = wtInfo.find('span', {'class':'genre'}).text.strip() sIndex = str(input(""" 다운로드 받고 싶은 횟차를 입력하세요. (exit 입력하면 다운로드 종료) (사용법) 1화 ~ 10화, 12화 모두 다운로드 : 1~10, 12 : """)).replace(' ', '').split(',') if sIndex == 'exit': ClearWindow(); break episode = [] for e in sIndex: if '~' in e: s = e.split('~') s1 = int(s[0]) s2 = int(s[1]) if s1 <= s2: InDe = 1 else: InDe = -1 section = list(range(int(s[0]), int(s[1])+InDe, InDe)) else: section = [int(e)] episode.extend(section) FinalInfo = "" Canceled = False for epi in episode: try: epiTitle = epiList[epi-1][0] epiLink = epiList[epi-1][1] except ( IndexError ): PrintInfo(f"{epi}화는 잘못된 횟차 수 입니다.") break epiIMGsURL = GetIMGsURL(epiLink) fname = sub('[\/:*?"<>|]', ' ', f"{wTitle}_{epiTitle}") dirLoc = f"./{fname}/" imgLoc = [] MakeDirectory(dirLoc) ClearWindow() print(f'\n제목 : {wTitle}' + f'\n\n작가 : {wAuthor}' + f'\n\n횟차 : {epi}화' + f'\n\n{wIntro}\n') for epiIMG in enumerate(epiIMGsURL): try: PrintProgressBar(epiIMG[0], len(epiIMGsURL), prefix=f'{infoBanner}', suffix=f'({epiIMG[0]}/{len(epiIMGsURL)})') imgName = f'{fname} {epiIMG[0]+1}.jpg' FastDownload(imgName, epiIMG[1]) imgLoc.append(f"{dirLoc}{imgName}") except ( KeyboardInterrupt, EOFError ): Canceled = True break ClearWindow() chdir('../') if Canceled == False: MakePDF(imgLoc, f"./{fname}.pdf", dirLoc) FinalInfo += f"{infoBanner} \"./{fname}.pdf\" 에 저장되었습니다.\n" else: rmtree(dirLoc, ignore_errors=True) PrintInfo('다운로드가 취소되었습니다.') break print() if FinalInfo.replace(' ', '') != "": print(FinalInfo, '\n') except ( KeyboardInterrupt, EOFError ): PrintInfo("다시 입력해주세요.")