Commit 0423194e authored by lhark's avatar lhark

Add a helper for smackjeeves.com

parent 7c670461
Pipeline #1984 failed with stages
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from RSSScraper import RSSScraper
from smackjeeves_helper import url_finder, img_finder, item_rewriter
if __name__ == "__main__":
ri = RSSScraper(
'itsahardlife',
'http://itsahardlife.smackjeeves.com/rss/',
url_finder, img_finder, item_rewriter)
ri.parse_feed()
ri.render()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from RSSScraper import RSSScraper
from smackjeeves_helper import url_finder, img_finder, item_rewriter
if __name__ == "__main__":
ri = RSSScraper(
'rain-lgbt',
'http://rainlgbt.smackjeeves.com/rss/',
url_finder, img_finder, item_rewriter)
ri.parse_feed()
ri.render()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bs4 import CData
def img_finder(soup, url):
img = soup.find('img', id='comic_image')
print("Image found at " + img['src'])
return img['src']
def url_finder(item):
return item.find('link').text
def item_rewriter(item, img):
cdata = CData('<img src="%s" />' % img)
item.find('description').string.replace_with(cdata)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from RSSScraper import RSSScraper
from webtoons_helper import url_finder, img_finder, item_rewriter
if __name__ == "__main__":
ri = RSSScraper(
'unordinary',
'https://www.webtoons.com/en/fantasy/unordinary/rss?title_no=679',
url_finder, img_finder, item_rewriter)
ri.parse_feed()
ri.render()
......@@ -3,13 +3,15 @@
from bs4 import CData
def img_finder(soup, url):
imgs = soup.find_all('img', '_images')
src = ''
for img in imgs:
if src != '':
src += '|'
img = img['data-url'].replace('webtoon-phinf.pstatic.net', 'swebtoon-phinf.pstatic.net')
img = img['data-url'].replace(
'webtoon-phinf.pstatic.net', 'swebtoon-phinf.pstatic.net')
src += img.split('?')[0]
return src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment