About the facebook safe image

2,704 views
Skip to first unread message

coco

unread,
Oct 21, 2014, 10:35:50 PM10/21/14
to web-s...@googlegroups.com
Hi, love your extension!!!!

My questions is how to download the safeimage on FB, there are two kinds images I want to download

1) common image, I could download and have the right image name, the links is :

https://scontent-a-lhr.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/s720x720/10386817_509968249106569_420327947266795842_n.jpg?oh=4d9fe22148bae48b39a69c402892cbda&oe=54F56D1C

2) Safe image, which I could not download, the download result is safe_image.php , this image links is: 

https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAZ4zpYdBAhWDMV&w=155&h=114&url=http%3A%2F%2Fi1.ytimg.com%2Fvi%2FgpSLkXb7st8%2Fhqdefault.jpg%3Ffeature%3Dog


Is there anyone could help me to figure out how to scrape this kind images, thanks a lot!!!!!!

sitemap:

{"selectors":[{"parentSelectors":["_root"],"type":"SelectorElementScroll","multiple":true,"id":"item","selector":"div div._1k4h > div._5sem > div._2d10 div.timelineUnitContainer","delay":"4000"},{"parentSelectors":["item"],"type":"SelectorText","multiple":false,"id":"comment","selector":"span.userContent","regex":"","delay":""},{"parentSelectors":["item"],"type":"SelectorText","multiple":false,"id":"time","selector":"div._1_n abbr","regex":"","delay":""},{"parentSelectors":["item"],"type":"SelectorLink","multiple":false,"id":"post","selector":"a._2qo3","delay":""},{"parentSelectors":["item"],"type":"SelectorText","multiple":false,"id":"like","selector":"div.UFILikeSentenceText a","regex":"","delay":""},{"parentSelectors":["item"],"type":"SelectorLink","multiple":false,"id":"user","selector":"span.fwb a","delay":""},{"parentSelectors":["item"],"type":"SelectorText","multiple":false,"id":"posttype","selector":"span.fcg > a","regex":"","delay":""},{"parentSelectors":["item"],"type":"SelectorImage","multiple":true,"id":"image","selector":"a.shareLink img.img, a.coverPhotoChangeUnit img.img","downloadImage":true,"delay":""}],"startUrl":"https://www.facebook.com/Imshmacked/timeline","_id":"facebooktest"}

Mārtiņš Balodis

unread,
Oct 23, 2014, 12:55:04 PM10/23/14
to coco, web-s...@googlegroups.com
Hi,
The problem is in image names. The first image has .jpg extension in the url but the second image has .php extension in the url. These .php images are actually jpg images. If you simply rename them from .php to .jpg then you could open them with an image viewer.

--
You received this message because you are subscribed to the Google Groups "Web Scraper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-scraper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

coco

unread,
Oct 24, 2014, 9:14:07 AM10/24/14
to web-s...@googlegroups.com, chenjun....@gmail.com
Thank you so much, Mārtiņš!  You helped me a lot!

A further question is how can I revise  the picture name? Because the name now are safepicture.php, safepicture1.php, etc. I could not match them to the picture links.

在 2014年10月23日星期四UTC-4下午12时55分04秒,Mārtiņš Balodis写道:

Mārtiņš Balodis

unread,
Oct 24, 2014, 11:45:58 AM10/24/14
to coco, web-s...@googlegroups.com
Hi,
You are right the images cannot be matched with their urls right now. A previous fix removed everything that was after the question mark "?" because a file name cannot contain that symbol. I don't have a solution that would work with the current extensions version but we can discuss an enhancement in the extension that would solve this problem. Maybe replacing special characters with their encoding might work? For example if the url is https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAZ4zpYdBAhWDMV&w=155&h=114&url=http%3A%2F%2Fi1.ytimg.com%2Fvi%2FgpSLkXb7st8%2Fhqdefault.jpg%3Ffeature%3Dog

Then the filename could be something like this:
safe_image.php%3Fd%3DAQAZ4zpYdBAhWDMV%26w%3D155%26h%3D114%26url%3Dhttp%3A%2F%2Fi1.ytimg.com%2Fvi%2FgpSLkXb7st8%2Fhqdefault.jpg%3Ffeature%3Dog

coco

unread,
Oct 24, 2014, 11:56:28 AM10/24/14
to web-s...@googlegroups.com, chenjun....@gmail.com
Thank you for your reply! Yes, that will be much better for my case! Should I revise the code for the scrapeimage.js ? And refer your previous version?

在 2014年10月24日星期五UTC-4上午11时45分58秒,Mārtiņš Balodis写道:

Mārtiņš Balodis

unread,
Oct 27, 2014, 9:41:57 AM10/27/14
to coco, web-s...@googlegroups.com
Hi,
I added a bug report in the issue tracker. I'll try to fix it some time this week.

coco

unread,
Oct 27, 2014, 10:11:25 AM10/27/14
to web-s...@googlegroups.com, chenjun....@gmail.com
Cool, thank you so much!!!! 

在 2014年10月27日星期一UTC-4上午9时41分57秒,Mārtiņš Balodis写道:

Scott

unread,
Oct 29, 2014, 9:20:29 PM10/29/14
to web-s...@googlegroups.com, chenjun....@gmail.com
Try opening the CSV file in excel, then select the columns that have the image names, then press ctrl+F to open the find box.  Click on the tab that says replace, then in the search box type ".php", in the replace with box type ".jpg", (without quotes).  Then select the replace all button, and you should be good to go.

coco

unread,
Oct 31, 2014, 11:27:16 PM10/31/14
to web-s...@googlegroups.com, chenjun....@gmail.com
Thank you ! But what I want to change is the name of image file, not the name in the links. Still thank you for your help:)

在 2014年10月29日星期三UTC-4下午9时20分29秒,Scott写道:

Mārtiņš Balodis

unread,
Nov 1, 2014, 3:26:49 AM11/1/14
to coco, web-s...@googlegroups.com
Hi,
Maybe I described the fix incorrectly. Now it saves files on disk like these ones:
safe_image.phpd=AQA25rRMy5z9hMS5&w=484&h=253&url=https%3A%2F%2Fcdn.shopify.com%2Fs%2Ffiles%2F1%2F0271%2F2383%2Ft%2F3%2Fassets%2Fin
safe_image.phpd=AQA-Ct2ejtJCRpJI&w=484&h=253&url=http%3A%2F%2Fwww.brobible.com%2Ffiles%2Fuploads%2Fimages%2FDaily-Buzz%2FScreen_sh
safe_image.phpd=AQAFfc4Ah01Rgfy2&w=155&h=114&url=http%3A%2F%2Fi1.ytimg.com%2Fvi%2FZyvWxvRLMZU%2Fhqdefault.jpg
Reply all
Reply to author
Forward
0 new messages