Quick! Write program in you favorite language which downloads all media attachments from a 4chan thread into the current directory.
The shortest code wins.
>>61554750
That's scripting and not a programming language
>>61554777
>Goes from "favorite language" to "programing language"
Of course
>>61554777
wrong
>>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.
>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
>>61554688
>>61556086
kek
>>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/