Python script for downloading image galleries

This is a simple Python script that will download all images from a specified image gallery into a folder with the gallery id (e.g., 252306). Requires Python 2.7 and the BeautifulSoup package. Indenting spaces don't seem to show up here, so you'll need to strip out the # before each line.

#from bs4 import BeautifulSoup
#import urllib
#import re
#import os
#
## Set this to the URL of the image gallery
#url = "http://xhamster.com/photos/gallery/252306/looking_up.html"
#
#def getBase(link):
# imgpage = BeautifulSoup(urllib****open(link['href']))
# imgs = imgpage.find_all(src=re.compile("_1000"))
# if len(imgs) > 0:
## return imgs[0]['src'].rsplit("/",1)[-2]
#
#
#page = BeautifulSoup(urllib****open(url))
#links = page.find_all('a')
#
#gallery_id = url.split("/")[-2]
#if not os.path.exists(gallery_id):
# os.makedirs(gallery_id)
#
## Get base URL for images
#base = ""
#for link in links:
# if gallery_id in link['href']:
## base = getBase(link)
## break
#
#print base
#for link in links:
# if gallery_id in link['href']:
## photo_id = link['href'].split(".html")[0][-3:]
## print photo_id
## if (photo_id.isdigit()):
### urllib****retrieve(base + "/" + photo_id + "_1000.jpg", gallery_id + "/" + photo_id + ".jpg")
10年前
コメント数
xHamsterは 成人専用のウェブサイトです!

xHamster で利用できるコンテンツの中には、ポルノ映像が含まれる場合があります。

xHamsterは18歳以上またはお住まいの管轄区域の法定年齢いずれかの年齢が高い方に利用を限定しています。

私たちの中核的目標の1つである、保護者の方が未成年によるxHamsterへのアクセスを制限できるよう、xHamsterはRTA (成人限定)コードに完全に準拠しています。つまり、簡単なペアレンタルコントロールツールで、サイトへのアクセスを防ぐことができるということです。保護者の方が、未成年によるオンライン上の不適切なコンテンツ、特に年齢制限のあるコンテンツへのアクセスを防御することは、必要かつ大事なことです。

未成年がいる家庭や未成年を監督している方は、パソコンのハードウェアとデバイス設定、ソフトウェアダウンロード、またはISPフィルタリングサービスを含む基礎的なペアレンタルコントロールを活用し、未成年が不適切なコンテンツにアクセスするのを防いでください。

운영자와 1:1 채팅