create account

RE: Daily Steem-Python Challenge #10, Win 1 Steem! by maxg

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @steempytutorials/daily-steem-python-challenge-10-win-1-steem

· @maxg ·
$0.43
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: \![link](https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png)

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 `![](stuff)` 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 ;)
👍  , ,
properties (23)
authormaxg
permlinkre-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t220924740z
categorycontest
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"}
created2018-01-23 22:09:24
last_update2018-01-23 22:09:24
depth1
children3
last_payout2018-01-30 22:09:24
cashout_time1969-12-31 23:59:59
total_payout_value0.338 HBD
curator_payout_value0.087 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,278
author_reputation5,859,582,764,121
root_title"Daily Steem-Python Challenge #10, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,753,032
net_rshares39,567,608,962
author_curate_reward""
vote details (3)
@juliank ·
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 ;)
properties (22)
authorjuliank
permlinkre-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180126t045723884z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-26 04:57:24
last_update2018-01-26 04:57:24
depth2
children0
last_payout2018-02-02 04:57:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length521
author_reputation117,823,071,447,502
root_title"Daily Steem-Python Challenge #10, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id32,378,798
net_rshares0
@maxg ·
[Steemd link](https://steemd.com/contest/@maxg/re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t220924740z)
properties (22)
authormaxg
permlinkre-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180123t221146999z
categorycontest
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"}
created2018-01-23 22:11:48
last_update2018-01-23 22:11:48
depth2
children0
last_payout2018-01-30 22:11:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation5,859,582,764,121
root_title"Daily Steem-Python Challenge #10, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,753,486
net_rshares0
@steempytutorials ·
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
properties (22)
authorsteempytutorials
permlinkre-maxg-re-steempytutorials-daily-steem-python-challenge-10-win-1-steem-20180125t121552195z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-25 12:15:51
last_update2018-01-25 12:15:51
depth2
children0
last_payout2018-02-01 12:15:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length154
author_reputation31,094,047,689,691
root_title"Daily Steem-Python Challenge #10, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id32,186,617
net_rshares0