Skip to content

fix(route/btbtla): cover all seasons, tolerate dead rows, add lazy mode#22291

Open
JaggerH wants to merge 1 commit into
DIYgod:masterfrom
JaggerH:feat/btbtla-multi-season
Open

fix(route/btbtla): cover all seasons, tolerate dead rows, add lazy mode#22291
JaggerH wants to merge 1 commit into
DIYgod:masterfrom
JaggerH:feat/btbtla-multi-season

Conversation

@JaggerH

@JaggerH JaggerH commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Involved Issue / 该 PR 相关 Issue

N/A

Example for the Proposed Route(s) / 路由地址示例

/btbtla/detail/雍正王朝
/btbtla/detail/雍正王朝/lazy

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

This improves the existing btbtla/detail route. It previously handled only a single exact-title match and a single quality tab, and one stale row could fail the whole feed.

  • Multi-season coverage. The old route exact-matched the title (a[title="${name}"]), so a show listed with a season suffix (e.g. 上载新生 第三季) returned nothing for the bare name. It now matches every search result whose title contains the query (deduped by href), covering all seasons/variants.
  • All quality tabs. Previously only the active/selected quality tab was parsed; now every quality tab is included, tagged via category.
  • Fault tolerance. btbtla leaves dead /tdown/ pages that return 404. The previous per-row magnet fetch threw on those, failing the entire feed. Resolution now tolerates per-row failures and drops stale rows.
  • Bounded concurrency. A popular show has 100+ download rows across seasons. Magnets are resolved with p-map (concurrency 5) + cache.tryGet, so refreshes are cheap (magnets are immutable) and we don't burst hundreds of requests at the site.
  • Optional /lazy mode. Resolving every magnet up front is the dominant cost for large shows. /btbtla/detail/:name/lazy returns the /tdown/ page links without resolving — for clients that resolve a single magnet on demand. The default stays eager so the feed carries real BT enclosures. It is a path param (not a query string) so it keys RSSHub's route cache distinctly — the cache key is the request path, query strings are ignored.

Season/quality info: quality goes into category; the season title and detail-page URL are attached under _extra (so they don't touch the standard rendered output but remain available to structured consumers reading the raw object / JSON Feed).

The /detail route only handled a single exact-title match and a single
quality tab, and a stale row could fail the whole feed. Changes:

- Multi-season: a show listed with a season suffix (e.g. "上载新生 第三季")
  never matched the bare name. Now matches every search result whose title
  contains the query (deduped), so all seasons/variants are covered.
- All quality tabs: previously only the active tab was parsed; now every
  tab is included and tagged via `category`.
- Fault tolerance: btbtla leaves dead /tdown/ pages that 404 — magnet
  resolution now tolerates per-row failures and drops stale rows instead
  of throwing and 503-ing the feed.
- Bounded concurrency: a popular show has 100+ rows across seasons; magnets
  are resolved with p-map (concurrency 5) + cache to avoid bursting requests.
- Optional `/lazy`: resolving every magnet up front is the dominant cost for
  big shows. `/btbtla/detail/:name/lazy` returns the /tdown/ links unresolved
  for clients that resolve one magnet on demand; default stays eager so the
  feed carries real BT enclosures. Path param (not query) so it keys the
  route cache distinctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the route label Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/btbtla/detail/雍正王朝 - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>BTBTLA | 雍正王朝</title>
    <link>https://www.btbtla.com/search/雍正王朝</link>
    <atom:link href="http://localhost:1200/btbtla/detail/%E9%9B%8D%E6%AD%A3%E7%8E%8B%E6%9C%9D" rel="self" type="application/rss+xml"></atom:link>
    <description>雍正王朝 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Tue, 16 Jun 2026 08:37:53 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>雍正王朝[第42-43集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.95GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709477216.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709477216.html</guid>
      <enclosure url="magnet:?xt=urn:btih:90f25ad0e295164e5fa122503ae2228cd47c6c26" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第40-41集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.94GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709033272.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709033272.html</guid>
      <enclosure url="magnet:?xt=urn:btih:d36607790fdd4433ffa621dea5b5069da5610b48" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第34-35集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.96GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/705732622.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/705732622.html</guid>
      <enclosure url="magnet:?xt=urn:btih:a40082f6c0f585ba6a3952df45f2941e3b02d397" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>[雍正王朝][全44集][WEB-MP4/83.9G][国语中字][1080P][高分经典] [夸克网盘]</title>
      <description></description>
      <link>https://www.btbtla.com/pdown/3366926.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/pdown/3366926.html</guid>
      <category>夸克网盘</category>
    </item>
    <item>
      <title>雍正王朝[第38-39集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [3.10GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/707425290.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/707425290.html</guid>
      <enclosure url="magnet:?xt=urn:btih:981f0e7d29714c022b870474933a9bfa9a873c93" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第36-37集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.91GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/706945052.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/706945052.html</guid>
      <enclosure url="magnet:?xt=urn:btih:1ee448e01214a5cb64772614111011194e9ea6e2" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][国语配音+中文字幕].Yong.Zheng.Wang.Chao.1997.1080p.WEB-DL.H265.AAC-Huawei [28.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245268540.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245268540.html</guid>
      <enclosure url="magnet:?xt=urn:btih:b5b2aba422cbdb0eaf872caa4c05bef7cab9b3de" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][中文字幕].Yong.Zheng.Wang.Chao.1999.Hami.WEB-DL.1080p.x264.AAC-Xiaomi [81.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245262228.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245262228.html</guid>
      <enclosure url="magnet:?xt=urn:btih:554efc5ed863d1f5ec9fa921858d2f53bb1ca95e" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
  </channel>
</rss>
http://localhost:1200/btbtla/detail/雍正王朝/lazy - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>BTBTLA | 雍正王朝</title>
    <link>https://www.btbtla.com/search/雍正王朝</link>
    <atom:link href="http://localhost:1200/btbtla/detail/%E9%9B%8D%E6%AD%A3%E7%8E%8B%E6%9C%9D/lazy" rel="self" type="application/rss+xml"></atom:link>
    <description>雍正王朝 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Tue, 16 Jun 2026 08:37:54 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>雍正王朝[第42-43集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.95GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709477216.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709477216.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第40-41集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.94GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709033272.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709033272.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第38-39集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [3.10GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/707425290.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/707425290.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第36-37集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.91GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/706945052.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/706945052.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第34-35集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.96GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/705732622.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/705732622.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][国语配音+中文字幕].Yong.Zheng.Wang.Chao.1997.1080p.WEB-DL.H265.AAC-Huawei [28.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245268540.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245268540.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][中文字幕].Yong.Zheng.Wang.Chao.1999.Hami.WEB-DL.1080p.x264.AAC-Xiaomi [81.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245262228.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245262228.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>[雍正王朝][全44集][WEB-MP4/83.9G][国语中字][1080P][高分经典] [夸克网盘]</title>
      <description></description>
      <link>https://www.btbtla.com/pdown/3366926.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/pdown/3366926.html</guid>
      <category>夸克网盘</category>
    </item>
  </channel>
</rss>

@github-actions github-actions Bot added the auto: ready to review Manual review will come in after lint issues and merge conflicts are fixed label Jun 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Auto Review

No clear rule violations found in the current diff.

@github-actions

Copy link
Copy Markdown
Contributor

Successfully generated as following:

http://localhost:1200/btbtla/detail/雍正王朝 - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>BTBTLA | 雍正王朝</title>
    <link>https://www.btbtla.com/search/雍正王朝</link>
    <atom:link href="http://localhost:1200/btbtla/detail/%E9%9B%8D%E6%AD%A3%E7%8E%8B%E6%9C%9D" rel="self" type="application/rss+xml"></atom:link>
    <description>雍正王朝 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Tue, 16 Jun 2026 08:39:02 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>雍正王朝[第36-37集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.91GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/706945052.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/706945052.html</guid>
      <enclosure url="magnet:?xt=urn:btih:1ee448e01214a5cb64772614111011194e9ea6e2" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第34-35集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.96GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/705732622.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/705732622.html</guid>
      <enclosure url="magnet:?xt=urn:btih:a40082f6c0f585ba6a3952df45f2941e3b02d397" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第42-43集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.95GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709477216.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709477216.html</guid>
      <enclosure url="magnet:?xt=urn:btih:90f25ad0e295164e5fa122503ae2228cd47c6c26" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>[雍正王朝][全44集][WEB-MP4/83.9G][国语中字][1080P][高分经典] [夸克网盘]</title>
      <description></description>
      <link>https://www.btbtla.com/pdown/3366926.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/pdown/3366926.html</guid>
      <category>夸克网盘</category>
    </item>
    <item>
      <title>雍正王朝[第40-41集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.94GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709033272.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709033272.html</guid>
      <enclosure url="magnet:?xt=urn:btih:d36607790fdd4433ffa621dea5b5069da5610b48" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第38-39集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [3.10GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/707425290.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/707425290.html</guid>
      <enclosure url="magnet:?xt=urn:btih:981f0e7d29714c022b870474933a9bfa9a873c93" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][中文字幕].Yong.Zheng.Wang.Chao.1999.Hami.WEB-DL.1080p.x264.AAC-Xiaomi [81.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245262228.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245262228.html</guid>
      <enclosure url="magnet:?xt=urn:btih:554efc5ed863d1f5ec9fa921858d2f53bb1ca95e" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][国语配音+中文字幕].Yong.Zheng.Wang.Chao.1997.1080p.WEB-DL.H265.AAC-Huawei [28.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245268540.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245268540.html</guid>
      <enclosure url="magnet:?xt=urn:btih:b5b2aba422cbdb0eaf872caa4c05bef7cab9b3de" type="application/x-bittorrent"></enclosure>
      <category>1080p</category>
    </item>
  </channel>
</rss>
http://localhost:1200/btbtla/detail/雍正王朝/lazy - Success ✔️
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>BTBTLA | 雍正王朝</title>
    <link>https://www.btbtla.com/search/雍正王朝</link>
    <atom:link href="http://localhost:1200/btbtla/detail/%E9%9B%8D%E6%AD%A3%E7%8E%8B%E6%9C%9D/lazy" rel="self" type="application/rss+xml"></atom:link>
    <description>雍正王朝 - Powered by RSSHub</description>
    <generator>RSSHub</generator>
    <webMaster>contact@rsshub.app (RSSHub)</webMaster>
    <language>en</language>
    <lastBuildDate>Tue, 16 Jun 2026 08:39:03 GMT</lastBuildDate>
    <ttl>5</ttl>
    <item>
      <title>雍正王朝[第42-43集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.95GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709477216.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709477216.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第40-41集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.94GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/709033272.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/709033272.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第38-39集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [3.10GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/707425290.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/707425290.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第36-37集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.91GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/706945052.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/706945052.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[第34-35集][国语配音+中文字幕].Yongzheng.Dynasty.S01.1999.1080p.WEB-DL.KKTV.AAC.H264-ParkTV [2.96GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/705732622.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/705732622.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][国语配音+中文字幕].Yong.Zheng.Wang.Chao.1997.1080p.WEB-DL.H265.AAC-Huawei [28.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245268540.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245268540.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>雍正王朝[全44集][中文字幕].Yong.Zheng.Wang.Chao.1999.Hami.WEB-DL.1080p.x264.AAC-Xiaomi [81.83GB] [1080p]</title>
      <description></description>
      <link>https://www.btbtla.com/tdown/245262228.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/tdown/245262228.html</guid>
      <category>1080p</category>
    </item>
    <item>
      <title>[雍正王朝][全44集][WEB-MP4/83.9G][国语中字][1080P][高分经典] [夸克网盘]</title>
      <description></description>
      <link>https://www.btbtla.com/pdown/3366926.html</link>
      <guid isPermaLink="false">https://www.btbtla.com/pdown/3366926.html</guid>
      <category>夸克网盘</category>
    </item>
  </channel>
</rss>

Comment on lines +151 to +160
const seen = new Set<string>();
const out: Array<{ href: string; title: string }> = [];
$('.module-items .module-item-titlebox a[href^="/detail/"]').each((_, el) => {
const href = $(el).attr('href');
const title = $(el).attr('title') ?? '';
if (!href || seen.has(href) || !title.includes(name)) {
return;
}
seen.add(href);
out.push({ href, title });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide the page URL that the search result returns duplicated href that requires using deduplication.

Comment on lines +126 to +140
const rows: Row[] = [];
$('div[name=download-list] .module-downlist').each((i, dl) => {
const quality = qualities[i] || '';
$(dl)
.find('.module-row-one .module-row-info')
.each((_, info) => {
const a = $(info).find('a.module-row-text');
const href = a.attr('href');
if (!href) {
return;
}
const title = $(info).find('.module-row-title h4').text().trim() || a.attr('title') || '';
rows.push({ title, downPage: ROOT_URL + href, quality, seasonTitle, seasonUrl });
});
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +69 to +88
let items: DataItem[];
if (lazy) {
items = rows.map((row) => buildItem(row, ''));
} else {
items = [];
await pMap(
rows,
async (row) => {
const isMagnetRow = row.downPage.includes('/tdown/');
const { magnet } = isMagnetRow ? await cache.tryGet(`btbtla:magnet:${row.downPage}`, async () => ({ magnet: await getMagnet(row.downPage) })) : { magnet: '' };
// Drop stale /tdown/ rows whose page 404'd (no magnet) — btbtla keeps
// dead entries in its listing. Non-BT rows (e.g. /pdown/ netdisk) stay.
if (isMagnetRow && !magnet) {
return;
}
return '';
});

return {
title,
link,
enclosure_url: magnet,
enclosure_type: 'application/x-bittorrent',
};
})
);

const moduleTitle = 'BTBTLA | ' + $('.page-title').text();
items.push(buildItem(row, magnet));
},
{ concurrency: CONCURRENCY }
);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto: ready to review Manual review will come in after lint issues and merge conflicts are fixed route

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants