From 10bf796c62fa844e22c198ad4975ee0b6b7689cf Mon Sep 17 00:00:00 2001 From: Kurt Bestor Date: Fri, 5 May 2023 06:07:55 +0900 Subject: [PATCH] ^q^ --- src/extractor/kakaopage_downloader.py | 441 +++++++++++++------------- src/extractor/torrent_downloader.py | 9 +- translation/changelog_en.txt | 18 ++ translation/changelog_ko.txt | 18 ++ 4 files changed, 264 insertions(+), 222 deletions(-) diff --git a/src/extractor/kakaopage_downloader.py b/src/extractor/kakaopage_downloader.py index 0104e58..48bc7b7 100644 --- a/src/extractor/kakaopage_downloader.py +++ b/src/extractor/kakaopage_downloader.py @@ -254,280 +254,281 @@ def get_imgs_page(page, session): html = read_html(page.url, session=session) url_api = 'https://page.kakao.com/graphql' q = r'''query viewerInfo($seriesId: Long!, $productId: Long!) { - viewerInfo(seriesId: $seriesId, productId: $productId) { - item { - ...SingleFragment - __typename - } - seriesItem { - ...SeriesFragment - __typename - } - prevItem { - ...NearItemFragment - __typename - } - nextItem { - ...NearItemFragment - __typename - } - viewerData { - ...TextViewerData - ...TalkViewerData - ...ImageViewerData - ...VodViewerData - __typename - } - displayAd { - ...DisplayAd - __typename - } - __typename - } + viewerInfo(seriesId: $seriesId, productId: $productId) { + item { + ...SingleFragment + __typename + } + seriesItem { + ...SeriesFragment + __typename + } + prevItem { + ...NearItemFragment + __typename + } + nextItem { + ...NearItemFragment + __typename + } + viewerData { + ...TextViewerData + ...TalkViewerData + ...ImageViewerData + ...VodViewerData + __typename + } + displayAd { + ...DisplayAd + __typename + } + __typename + } } fragment SingleFragment on Single { - id - productId - seriesId - title - thumbnail - badge - isFree - ageGrade - state - slideType - lastReleasedDate - size - pageCount - isHidden - freeChangeDate - isWaitfreeBlocked - saleState - series { - ...SeriesFragment - __typename - } - serviceProperty { - ...ServicePropertyFragment - __typename - } - operatorProperty { - ...OperatorPropertyFragment - __typename - } - assetProperty { - ...AssetPropertyFragment - __typename - } + id + productId + seriesId + title + thumbnail + badge + isFree + ageGrade + state + slideType + lastReleasedDate + size + pageCount + isHidden + remainText + isWaitfreeBlocked + saleState + series { + ...SeriesFragment + __typename + } + serviceProperty { + ...ServicePropertyFragment + __typename + } + operatorProperty { + ...OperatorPropertyFragment + __typename + } + assetProperty { + ...AssetPropertyFragment + __typename + } } fragment SeriesFragment on Series { - id - seriesId - title - thumbnail - categoryUid - category - subcategoryUid - subcategory - badge - isAllFree - isWaitfree - isWaitfreePlus - is3HoursWaitfree - ageGrade - state - onIssue - seriesType - businessModel - authors - pubPeriod - freeSlideCount - lastSlideAddedDate - waitfreeBlockCount - waitfreePeriodByMinute - bm - saleState - serviceProperty { - ...ServicePropertyFragment - __typename - } - operatorProperty { - ...OperatorPropertyFragment - __typename - } - assetProperty { - ...AssetPropertyFragment - __typename - } + id + seriesId + title + thumbnail + categoryUid + category + categoryType + subcategoryUid + subcategory + badge + isAllFree + isWaitfree + isWaitfreePlus + is3HoursWaitfree + ageGrade + state + onIssue + authors + pubPeriod + freeSlideCount + lastSlideAddedDate + waitfreeBlockCount + waitfreePeriodByMinute + bm + saleState + serviceProperty { + ...ServicePropertyFragment + __typename + } + operatorProperty { + ...OperatorPropertyFragment + __typename + } + assetProperty { + ...AssetPropertyFragment + __typename + } } fragment ServicePropertyFragment on ServiceProperty { - viewCount - readCount - ratingCount - ratingSum - commentCount - pageContinue { - ...ContinueInfoFragment - __typename - } - todayGift { - ...TodayGift - __typename - } - waitfreeTicket { - ...WaitfreeTicketFragment - __typename - } - isAlarmOn - isLikeOn - ticketCount - purchasedDate - lastViewInfo { - ...LastViewInfoFragment - __typename - } - purchaseInfo { - ...PurchaseInfoFragment - __typename - } + viewCount + readCount + ratingCount + ratingSum + commentCount + pageContinue { + ...ContinueInfoFragment + __typename + } + todayGift { + ...TodayGift + __typename + } + waitfreeTicket { + ...WaitfreeTicketFragment + __typename + } + isAlarmOn + isLikeOn + ticketCount + purchasedDate + lastViewInfo { + ...LastViewInfoFragment + __typename + } + purchaseInfo { + ...PurchaseInfoFragment + __typename + } } fragment ContinueInfoFragment on ContinueInfo { - title - isFree - productId - lastReadProductId - scheme - continueProductType - hasNewSingle - hasUnreadSingle + title + isFree + productId + lastReadProductId + scheme + continueProductType + hasNewSingle + hasUnreadSingle } fragment TodayGift on TodayGift { - id - uid - ticketType - ticketKind - ticketCount - ticketExpireAt - isReceived + id + uid + ticketType + ticketKind + ticketCount + ticketExpireAt + ticketExpiredText + isReceived } fragment WaitfreeTicketFragment on WaitfreeTicket { - chargedPeriod - chargedCount - chargedAt + chargedPeriod + chargedCount + chargedAt } fragment LastViewInfoFragment on LastViewInfo { - isDone - lastViewDate - rate - spineIndex + isDone + lastViewDate + rate + spineIndex } fragment PurchaseInfoFragment on PurchaseInfo { - purchaseType - rentExpireDate + purchaseType + rentExpireDate + expired } fragment OperatorPropertyFragment on OperatorProperty { - thumbnail - copy - torosImpId - torosFileHashKey - isTextViewer + thumbnail + copy + torosImpId + torosFileHashKey + isTextViewer } fragment AssetPropertyFragment on AssetProperty { - bannerImage - cardImage - cardTextImage - cleanImage - ipxVideo + bannerImage + cardImage + cardTextImage + cleanImage + ipxVideo } fragment NearItemFragment on NearItem { - productId - slideType - ageGrade - isFree - title - thumbnail + productId + slideType + ageGrade + isFree + title + thumbnail } fragment TextViewerData on TextViewerData { - type - atsServerUrl - metaSecureUrl - contentsList { - chapterId - contentId - secureUrl - __typename - } + type + atsServerUrl + metaSecureUrl + contentsList { + chapterId + contentId + secureUrl + __typename + } } fragment TalkViewerData on TalkViewerData { - type - talkDownloadData { - dec - host - path - talkViewerType - __typename - } + type + talkDownloadData { + dec + host + path + talkViewerType + __typename + } } fragment ImageViewerData on ImageViewerData { - type - imageDownloadData { - ...ImageDownloadData - __typename - } + type + imageDownloadData { + ...ImageDownloadData + __typename + } } fragment ImageDownloadData on ImageDownloadData { - files { - ...ImageDownloadFile - __typename - } - totalCount - totalSize - viewDirection - gapBetweenImages - readType + files { + ...ImageDownloadFile + __typename + } + totalCount + totalSize + viewDirection + gapBetweenImages + readType } fragment ImageDownloadFile on ImageDownloadFile { - no - size - secureUrl - width - height + no + size + secureUrl + width + height } fragment VodViewerData on VodViewerData { - type - vodDownloadData { - contentId - drmType - endpointUrl - width - height - duration - __typename - } + type + vodDownloadData { + contentId + drmType + endpointUrl + width + height + duration + __typename + } } fragment DisplayAd on DisplayAd { - sectionUid - bannerUid - treviUid - momentUid + sectionUid + bannerUid + treviUid + momentUid } ''' data = { diff --git a/src/extractor/torrent_downloader.py b/src/extractor/torrent_downloader.py index 80b761d..85d6e52 100644 --- a/src/extractor/torrent_downloader.py +++ b/src/extractor/torrent_downloader.py @@ -110,6 +110,8 @@ def name(self): @classmethod def get_dn(cls, url): + if not url: + return if url.startswith('magnet:'): qs = utils.query_url(url) if 'dn' in qs: @@ -122,7 +124,7 @@ def read(self): if cw: cw._torrent_s = None title = self.url - self._dn = self.get_dn(self.url) + self._dn = self.get_dn(cw.gal_num) info = getattr(cw, 'info?', None) if info is not None: self.print_('cached info') @@ -400,7 +402,10 @@ def _callback(self, h, s, alerts): if what == 'file_completed': index = alert['index'] index = self._torrent_index[index] - file = os.path.realpath(names[index]) + try: + file = os.path.realpath(names[index]) + except IndexError: + continue #??? cw.dones.add(file) file = constants.compact(file).replace('\\', '/') files = file.split('/') diff --git a/translation/changelog_en.txt b/translation/changelog_en.txt index 1d04691..8317827 100644 --- a/translation/changelog_en.txt +++ b/translation/changelog_en.txt @@ -1,3 +1,21 @@ +3.8c 【May 05, 2023】 + +[버그 해결 / 사이트 변경에 의한 수정] + +- 카카오페이지 업데이트 대응 (#5806) + +- --safemode 버그 해결 (#5934) + +- 기타 자잘한 것들 + + +[변경/추가된 기능] + +- 기타 자잘한 것들 + + + +-------------------------------------------------------------------------------------------------------------------------------------------- 3.8b 【May 02, 2023】 [버그 해결 / 사이트 변경에 의한 수정] diff --git a/translation/changelog_ko.txt b/translation/changelog_ko.txt index c56d403..701bc67 100644 --- a/translation/changelog_ko.txt +++ b/translation/changelog_ko.txt @@ -1,3 +1,21 @@ +3.8c 【May 05, 2023】 + +[버그 해결 / 사이트 변경에 의한 수정] + +- 카카오페이지 업데이트 대응 (#5806) + +- --safemode 버그 해결 (#5934) + +- 기타 자잘한 것들 + + +[변경/추가된 기능] + +- 기타 자잘한 것들 + + + +-------------------------------------------------------------------------------------------------------------------------------------------- 3.8b 【May 02, 2023】 [버그 해결 / 사이트 변경에 의한 수정]