Andreas Demmelbauer 5 лет назад
Родитель
Сommit
a4b9e7db7c
1 измененных файлов: 4 добавлений и 4 удалений
  1. +4
    -4
      feedcake.py

+ 4
- 4
feedcake.py Просмотреть файл

@@ -34,7 +34,7 @@ assets_path = public_path + '/assets'
feeds_path = public_path + '/feeds'

# e.g. https://example.com/some-string
asset_url = config['asset_url']
assets_url = config['assets_url']



@@ -155,13 +155,13 @@ def process_feed(feed_url, output_filename):
old_url = img['data-src']
if not old_url.startswith('data:'):
new_filename = filename_from_url(old_url)
img['data-src'] = asset_url + '/' + entry_dir + '/' + new_filename
img['data-src'] = assets_url + '/' + entry_dir + '/' + new_filename
download_image(old_url, entry_dir, new_filename)
if img.get('src'):
old_url = img['src']
if not old_url.startswith('data:'):
new_filename = filename_from_url(old_url)
img['src'] = asset_url + '/' + entry_dir + '/' + new_filename
img['src'] = assets_url + '/' + entry_dir + '/' + new_filename
download_image(old_url, entry_dir, new_filename)
if img.get('data-srcset'):
srcset = img['data-srcset'].split(', ')
@@ -171,7 +171,7 @@ def process_feed(feed_url, output_filename):
src_res = src.split(' ')[1]
new_filename = filename_from_url(old_url)
download_image(old_url, entry_dir, new_filename)
new_url = asset_url + '/' + entry_dir + '/' + new_filename
new_url = assets_url + '/' + entry_dir + '/' + new_filename
src = ' '.join([new_url, src_res])
new_srcset.append(src)
img['data-srcset'] = ', '.join(new_srcset)


Загрузка…
Отмена
Сохранить