strohne / Facepager

Facepager was made for fetching public available data from YouTube, Twitter and other websites on the basis of APIs and webscraping.
https://github.com/strohne/Facepager/releases
506 stars 198 forks source link

File-Tab: Encode/Extract Picture-Names | file-naming pattern #24

Closed dorvak closed 10 years ago

dorvak commented 10 years ago

Some Pictrues and other resources from facebook throw a File-Creation Error due to their name, f.e. https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBGKf_DPP-FtQdF&w=154&h=154&url=http%3A%2F%2Fwww.bundeskanzlerin.de%2FContent%2FDE%2FArtikel%2F2014%2F02%2FBilder%2F2014-02-18-eskalation-ukraine.jpg%3Bjsessionid%xxxx2%3F__blob%3DbpaTopmeldung%26v%3D3

will result in a filename like "safe_image.php?d=AQBGKf_DPP-FtQdF&w=154&h=154&url=http%3A%2F%2Fwww.bundeskanzlerin.de%2FContent%2FDE%2FArtikel%2F2014%2F02%2FBilder%2F2014-02-18-eskalation-ukraine.jpg%3Bjsessionid%3D85F8048B6FE745F7B0CFC5D95AD1F484-2014-03-28-09-52-12-1.jpeg'"

We should use the urlllib-library (urlparse)-Functions & the os.path-Function to create a valid path (or use the object-ID as a fallback, when the file-creation throws an exception due to a invalid name). As an additional feature, we could provide pattern-based file naming, f.e. _

strohne commented 10 years ago

fixed: 1. allow custom filenames and extensions; 2. clean filename and extension

dorvak commented 10 years ago

Perfect! Works fine for me