forked from EstrellaXD/Auto_Bangumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aeac217
commit 6681590
Showing
4 changed files
with
64 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import re | ||
from urllib3.util import parse_url | ||
|
||
from module.rss import RSSEngine | ||
|
||
|
||
def from_30_to_31(): | ||
with RSSEngine() as db: | ||
db.migrate() | ||
# Update poster link | ||
bangumis = db.bangumi.search_all() | ||
rss_pool = [] | ||
for bangumi in bangumis: | ||
if bangumi.poster_link: | ||
rss_link = bangumi.rss_link.split(",")[-1] | ||
if rss_link not in rss_pool and not re.search(r"\d+.\d+.\d+.\d+", rss_link): | ||
rss_pool.append(rss_link) | ||
root_path = parse_url(rss_link).host | ||
bangumi.poster_link = f"https://{root_path}{bangumi.poster_link}" | ||
db.bangumi.update_all(bangumis) | ||
for rss in rss_pool: | ||
db.add_rss(rss_link=rss) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters