<center>https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png</center> For each tutorial we release there will be a relevant challenge where the winner receives 1 STEEM! ### Challenge Take the code from the tutorial from [here](https://github.com/amosbastian/steempy-tutorials/blob/master/part_11). In the code you learned how to extract image urls from the Post object. However not every Steem platform stores the post metadata as gracefully as Steemit.com does. Below are 3 example posts where image urls are not as straight forward to retrieve from. 1. Alter the code that is checks which platform was used to submit the post and use another way to retrieve the image url. ``` https://steemit.com/bescouted/@vladkuneberg/red-green-contrast https://steemit.com/photofeed/@pcusine/hotel-w-barcelona-1516230216 https://steemit.com/colourfulphotography/@klborillo/flowers-for-sale-2018-01-18-00-15-59 ``` <br> That's it! Good luck to everyone participating! ### Deadline The prize money will be rewarded to the person that solves the problem first. If there is no solution within 7 days after this post has been submitted the prize pool expires. ### Relevant Tutorial [Part 10: Use Urls To Retrieve Post Data And Construct A Dynamic Post With Steem-Python](https://steemit.com/utopian-io/@steempytutorials/part-10-use-urls-to-retrieve-post-data-and-construct-a-dynamic-post-with-steem-python) --- If you have questions about the tutorial or the challenge then don't hesitate to comment below or contact us on [Discord](https://discord.gg/rYTV87W)!
author | steempytutorials |
---|---|
permlink | daily-steem-python-challenge-10-win-1-steem |
category | contest |
json_metadata | {"tags":["contest","python","bot","programming"],"image":["https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png"],"links":["https://github.com/amosbastian/steempy-tutorials/blob/master/part_11","https://steemit.com/utopian-io/@steempytutorials/part-10-use-urls-to-retrieve-post-data-and-construct-a-dynamic-post-with-steem-python","https://discord.gg/rYTV87W"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-01-23 12:04:54 |
last_update | 2018-01-23 12:04:54 |
depth | 0 |
children | 7 |
last_payout | 2018-01-30 12:04:54 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 4.786 HBD |
curator_payout_value | 0.047 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,594 |
author_reputation | 31,094,047,689,691 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 31,631,964 |
net_rshares | 433,353,084,054 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 407,788,844,801 | 30% | ||
gotas | 0 | 347,261,914 | 100% | ||
eggorich19 | 0 | 51,624,703 | 100% | ||
emrebeyler | 0 | 629,884,356 | 1% | ||
maxg | 0 | 1,654,621,455 | 100% | ||
tarmizislow | 0 | 214,938,361 | 100% | ||
amosbastian | 0 | 13,578,723,663 | 100% | ||
veenox | 0 | 182,102,847 | 100% | ||
oups | 0 | 932,850,088 | 100% | ||
fisherck | 0 | 1,223,175,949 | 100% | ||
evseevamaria | 0 | 445,773,500 | 100% | ||
steempytutorials | 0 | 2,914,349,981 | 100% | ||
evanprice | 0 | 702,595,418 | 100% | ||
johangericke | 0 | 1,396,241,850 | 100% | ||
stillbetty | 0 | 230,437,500 | 100% | ||
aripeng | 0 | 503,558,635 | 100% | ||
luj1 | 0 | 556,099,033 | 100% |
Here is my [solution](https://gist.github.com/emre/38dba6b42c87341e0dc50b0d7b3fde1a). I guess the best shot is creating different patterns/adapters for every known platform and if it's not a known platform fallback to general image finder pattern.
author | emrebeyler |
---|---|
permlink | re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t140116368z |
category | contest |
json_metadata | {"tags":["contest"],"links":["https://gist.github.com/emre/38dba6b42c87341e0dc50b0d7b3fde1a"],"app":"steemit/0.1"} |
created | 2018-01-23 14:01:15 |
last_update | 2018-01-23 14:01:15 |
depth | 1 |
children | 2 |
last_payout | 2018-01-30 14:01:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.200 HBD |
curator_payout_value | 0.041 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 248 |
author_reputation | 448,535,049,068,622 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 31,655,889 |
net_rshares | 22,065,626,820 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 11,936,695,779 | 1% | ||
turbot | 0 | 5,244,403,847 | 100% | ||
maxg | 0 | 1,694,017,204 | 100% | ||
steempytutorials | 0 | 3,190,509,990 | 100% |
Your code check out fine, will transfer the Steem. Also learned something from you code, thanks ;)
author | juliank |
---|---|
permlink | re-emrebeyler-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180126t044932644z |
category | contest |
json_metadata | {"tags":["contest"],"app":"steemit/0.1"} |
created | 2018-01-26 04:49:33 |
last_update | 2018-01-26 04:49:33 |
depth | 2 |
children | 0 |
last_payout | 2018-02-02 04:49:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 98 |
author_reputation | 117,823,071,447,502 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 32,377,476 |
net_rshares | 0 |
I agree on that. Will be going over the code now.
author | steempytutorials |
---|---|
permlink | re-emrebeyler-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180125t121421114z |
category | contest |
json_metadata | {"tags":["contest"],"app":"steemit/0.1"} |
created | 2018-01-25 12:14:21 |
last_update | 2018-01-25 12:14:21 |
depth | 2 |
children | 0 |
last_payout | 2018-02-01 12:14:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 49 |
author_reputation | 31,094,047,689,691 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 32,186,292 |
net_rshares | 0 |
Look at the Steemd for this comment. Unfortunately I think this challenge is _much_ harder than it appears if you want to get finniky with it- especially since some markdown parsers don't always work the way you expect them to. How do you tell the difference between say a [link](https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png) that isn't really part of a post, and an image? You can also escape the ! to make an image appear as a link. Example: \ Also - can't assume that the image is going to have a [valid extension](https://stackoverflow.com/questions/5110384/can-i-use-images-without-extension-in-img). For example, this is a link if I paste it in straight up. https://steemitimages.com/DQmS9uzwXDM9HWNSM5G5EPhFd9VLi5Miva5MZdTPjcwL6rb/image Now if I add the `` it gets interpreted as an image. https://steemitimages.com/DQmS9uzwXDM9HWNSM5G5EPhFd9VLi5Miva5MZdTPjcwL6rb/image.png I think the only way to come up with a solution that really works for all platforms is to render the page on Steemit and inspect that for valid image tags with something like BeautifulSoup. Anything else will only work 99% of the time ;)
author | maxg |
---|---|
permlink | re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t220924740z |
category | contest |
json_metadata | {"tags":["contest"],"image":["https://steemitimages.com/DQmS9uzwXDM9HWNSM5G5EPhFd9VLi5Miva5MZdTPjcwL6rb/image.png"],"links":["https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png","https://stackoverflow.com/questions/5110384/can-i-use-images-without-extension-in-img","https://steemitimages.com/DQmS9uzwXDM9HWNSM5G5EPhFd9VLi5Miva5MZdTPjcwL6rb/image"],"app":"steemit/0.1"} |
created | 2018-01-23 22:09:24 |
last_update | 2018-01-23 22:09:24 |
depth | 1 |
children | 3 |
last_payout | 2018-01-30 22:09:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.338 HBD |
curator_payout_value | 0.087 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,278 |
author_reputation | 5,859,582,764,121 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 31,753,032 |
net_rshares | 39,567,608,962 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 35,810,087,339 | 3% | ||
emrebeyler | 0 | 630,821,833 | 1% | ||
steempytutorials | 0 | 3,126,699,790 | 100% |
Took some time to go over your comment. All of your points are valid and what they truly show is how complicated a decentralised system is. All of the different apps using their own slight variations makes for these annoying exceptions. As for "render the page on Steemit and inspect that for valid image tags with something like BeautifulSoup" that sounds interesting. I have no experience with this. How I currently deal with the issue is basically verifying each post beforehand and filtering out any 1% by hand ;)
author | juliank |
---|---|
permlink | re-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180126t045723884z |
category | contest |
json_metadata | {"tags":["contest"],"app":"steemit/0.1"} |
created | 2018-01-26 04:57:24 |
last_update | 2018-01-26 04:57:24 |
depth | 2 |
children | 0 |
last_payout | 2018-02-02 04:57:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 521 |
author_reputation | 117,823,071,447,502 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 32,378,798 |
net_rshares | 0 |
[Steemd link](https://steemd.com/contest/@maxg/re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t220924740z)
author | maxg |
---|---|
permlink | re-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t221146999z |
category | contest |
json_metadata | {"tags":["contest"],"links":["https://steemd.com/contest/@maxg/re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t220924740z"],"app":"steemit/0.1"} |
created | 2018-01-23 22:11:48 |
last_update | 2018-01-23 22:11:48 |
depth | 2 |
children | 0 |
last_payout | 2018-01-30 22:11:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 131 |
author_reputation | 5,859,582,764,121 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 31,753,486 |
net_rshares | 0 |
This one is indeed a lot harder that you might initially think. Actually an issue I have to deal with on a daily basis :P Will be going over your code now
author | steempytutorials |
---|---|
permlink | re-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180125t121552195z |
category | contest |
json_metadata | {"tags":["contest"],"app":"steemit/0.1"} |
created | 2018-01-25 12:15:51 |
last_update | 2018-01-25 12:15:51 |
depth | 2 |
children | 0 |
last_payout | 2018-02-01 12:15:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 154 |
author_reputation | 31,094,047,689,691 |
root_title | "Daily Steem-Python Challenge #10, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 32,186,617 |
net_rshares | 0 |