[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Quick! Write program in you favorite language which downloads

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 29
Thread images: 5

File: 1475586063837.jpg (181KB, 634x635px) Image search: [Google]
1475586063837.jpg
181KB, 634x635px
Quick! Write program in you favorite language which downloads all media attachments from a 4chan thread into the current directory.
The shortest code wins.
>>
>>61554688
curl -O https://i.4cdn.org/g/1500990472166.jpg

:^)
>>
>>61554750
That's scripting and not a programming language
>>
>>61554777
>Goes from "favorite language" to "programing language"
Of course
>>
>>61554777
wrong
>>
File: 1493432883578.jpg (54KB, 450x600px) Image search: [Google]
1493432883578.jpg
54KB, 450x600px
>>61554750
Oh we are shell scripting?
wget -nc -nd -nv -e robots=off -ER html,s.jpg -rHD i.4cdn.org <thread>
>>
>>61554797
Actually -nc and -nv isn't needed, but it's less spam and saner.
>>
>>61554688
images = self.driver.find_elements_by_tag_name('img')
for image in images:
src = image.get_attribute("src")
if src:
urllib.urlretrieve(src)
>>
>>61556069
>> https://www.quora.com/How-do-I-download-all-images-from-a-website-using-Python
>>
>>61554777
Name one (1) way that bash isn't a programming language.
>>
>>61556736
Uhm sweetie, bash is in shells. That's script.
>>
>>61554688
Or else what?
>>
>>61557370
I just feel like /g/ is full of these people. To dumb to know how dumb they are
>>
>>61557461

Here you are hanging out with them.
>>
File: 1498710679358-r9k.jpg (15KB, 240x250px) Image search: [Google]
1498710679358-r9k.jpg
15KB, 240x250px
>not just physically stealing the server hosting the thread.

Nice try friendo :^)
>>
The best answer without a doubt is perl. Its meant to do this kind of stuff as easy as possible. Theres probably a cpan module for exactly that.
>>
didn't write this, just lifted it from an old /g/ thread.
wget -erobots=off -nd -rHD4cdn.org -Ajpg,png,gif,webm -Rs.jpg 
<url>
>>
>>61554688
Télécharger des images
>>
>>61558548
Stupidity doesn't spread by osmosis. This is like going to the zoo and watching the monkeys for us, bro.
>>
>>61554777
Bash is Turing complete, so it's a programming language.
>>
>>61554688
>open attachment
>right click
>save
>move to next attachment
:^)
>>
BIRDMIN NO
>>
File: capture207-2017-07-26.png (5KB, 495x52px) Image search: [Google]
capture207-2017-07-26.png
5KB, 495x52px
>>61554688
>>
>>61556086
kek
>>
File: werks.png (8KB, 461x112px) Image search: [Google]
werks.png
8KB, 461x112px
>>61554688
Oh alright.. stupid bird..

require 'open-uri'

html = open(ARGV[0]).read
urls = html.scan(/(i\.4cdn\.org\/g\/1[0-9]{12}\.)(jpg|png|gif|webm)/)
urls.uniq.each do |url|
furl = 'http://' + url.join
File.open(furl.split('/').last, 'wb') do |pic|
puts 'Downloading: ' + furl
pic.write open(furl).read
end
end
>>
>>61562673
oh crap, the regex only works on /g/.. oh well, fix it yourself.
>>
>>61554688
Not sure if this counts, but this is actually a script I've been working on. I'm still pretty much a novice, so I'm sure there are a bunch of things I could've done better, but it downloads all images in a thread if a thread url is given as the argument, and all images from a board if a catalog link is given. If it's downloading a single thread, it'll download all images, then wait 60 seconds and download any new images. It's multithreaded and will download each image into a folder for the thread it's in
https://pastebin.com/65v7DpVg
>>
>>61558612
Perl is fucking garbage.
>>
>>61554688

Current directory?

Casual mode,, at least create some sub folders,, and put that shit in /microsoft office/users/Dan/logs/HTML/old/
Thread posts: 29
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.