This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Strip & Save images from a given link

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
B
BigToe
Halfop
Posts: 99
Joined: Thu Dec 30, 2010 4:49 pm

Strip & Save images from a given link

Post by BigToe »

hi I need a strip that once a link is entered in the form of !strip <link here>

It will write the link to a file called 'dupes.db' that is located in /home/botdir/eggdrops/scripts/dupes.db

And will save to the shell to /home/botdir/eggdrops/images/ all the images that are on that link.

For example:

!strip http://www.imdb.com/news/ni30809410/

will download and save all the images on that page and add http://www.imdb.com/news/ni30809410/ to dupes.db
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

If you need images from<img> tag, try something like this:

Code: Select all

#!/usr/bin/tclsh

package require http
package require htmlparse

set http_handle [http::geturl "http://www.imdb.com/news/ni30809410/"]
set http_data [http::data $http_handle]

set img_link ""

proc zonk { tag slash param tbtt} {
        if {$tag == "img"} {
                #add ' to the regex etc.
                regsub -all -nocase {.*src=\"(.*?)\".*} $param {\1} img_link
                puts $img_link
        }
}

::htmlparse::parse -cmd zonk $http_data
Do the rest for the egg.
Post Reply