校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > python爬蟲竟然被小伙用來算命

python爬蟲竟然被小伙用來算命

熱門標(biāo)簽:長沙高頻外呼系統(tǒng)原理是什么 宿遷星美防封電銷卡 外呼并發(fā)線路 地圖標(biāo)注審核表 西藏房產(chǎn)智能外呼系統(tǒng)要多少錢 百度地圖標(biāo)注沒有了 湛江智能外呼系統(tǒng)廠家 ai電話機器人哪里好 ai電銷機器人源碼

前言

相信在日常生活中,平常大家聚在一起總會聊聊天,特別是女生(有冒犯到doge)非常喜歡聊星座,這個男生什么星座呀,那個男生什么星座呀…今天我就來滿足各位的需求,通過爬蟲來知曉上天的安排:

開搞!

1.網(wǎng)站分析

第一步呢,咋們先打開這個網(wǎng)站:https://www.horoscope.com/us/index.aspx

大家就能看到這個頁面了

我們今天呢,就先做一個通過星座來得知三天的運勢的小玩意,

這里有十二個星座,我點了第一個和第二個進(jìn)去,也就是白羊座和金牛座:

就會發(fā)現(xiàn)一個規(guī)律


通過觀察網(wǎng)址的鏈接,我這張丑臉泛起了燦爛的笑容。

也就是說,https://www.horoscope.com/us/horoscopes/general/是每個星座都共有的一段網(wǎng)址,

horoscope-general-daily-today.aspx?sign=1

我們只需改變today和sign={}對應(yīng)的值就可以獲取到每個星座對應(yīng)的網(wǎng)址了

https://www.horoscope.com/us/horoscopes/general/horoscope-general-daily-today.aspx?sign=1

我們再打開金牛座的昨天的運勢,發(fā)現(xiàn)daily-后面變成了tomorrow

我們這里只獲取三天的,也就是昨天,今天,明天,我們只需在控制臺輸入需要查詢的日期就行了。

2.獲取內(nèi)容

從圖片我們可以得到我們所需的內(nèi)容,這個是很基礎(chǔ)的爬蟲了,沒有反爬,我們直接上代碼了。

3.代碼

from bs4 import BeautifulSoup
import requests

def horoscope(zodiac_sign: int, day: str) -> str:
    url = (
        "https://www.horoscope.com/us/horoscopes/general/"
        f"horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"
    )#獲取需要查詢的星座的鏈接
    soup = BeautifulSoup(requests.get(url).content, "html.parser")
    return soup.find("div", class_="main-horoscope").p.text#返回得到的內(nèi)容——來自上天的指示

如果有小伙伴不知道自己的星座怎么辦呢,所以我們就還需要一個函數(shù)去查詢星座:

def check_sign():#得到星座
    your_birth_day = input("輸入您的生日的日期> ")
    your_birth_month = input("輸入你生日的月份> ")
    if (int(your_birth_month) == 12 and int(your_birth_day) >= 22) or (
        int(your_birth_month) == 1 and int(your_birth_day) = 19
    ):
        sign = "Capricorn"
    elif (int(your_birth_month) == 1 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 2 and int(your_birth_day) = 17
    ):
        sign = "Aquarium"
    elif (int(your_birth_month) == 2 and int(your_birth_day) >= 18) or (
        int(your_birth_month) == 3 and int(your_birth_day) = 19
    ):
        sign = "Pices"
    elif (int(your_birth_month) == 3 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 4 and int(your_birth_day) = 19
    ):
        sign = "Aries"
    elif (int(your_birth_month) == 4 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 5 and int(your_birth_day) = 20
    ):
        sign = "Taurus"
    elif (int(your_birth_month) == 5 and int(your_birth_day) >= 21) or (
        int(your_birth_month) == 6 and int(your_birth_day) = 20
    ):
        sign = "Gemini"
    elif (int(your_birth_month) == 6 and int(your_birth_day) >= 21) or (
        int(your_birth_month) == 7 and int(your_birth_day) = 22
    ):
        sign = "Cancer"
    elif (int(your_birth_month) == 7 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 8 and int(your_birth_day) = 22
    ):
        sign = "Leo"
    elif (int(your_birth_month) == 8 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 9 and int(your_birth_day) = 22
    ):
        sign = "Virgo"
    elif (int(your_birth_month) == 9 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 10 and int(your_birth_day) = 22
    ):
        sign = "Libra"
    elif (int(your_birth_month) == 10 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 11 and int(your_birth_day) = 21
    ):
        sign = "Scorpio"
    elif (int(your_birth_month) == 11 and int(your_birth_day) >= 22) or (
        int(your_birth_month) == 12 and int(your_birth_day) = 21
    ):
        sign = "Sagittarius"

    return sign

4.實操


怎么樣?很有趣吧,當(dāng)然網(wǎng)站有很多的用處,等以后我會繼續(xù)更新,實現(xiàn)更多的好玩的功能。

5.代碼整合

from bs4 import BeautifulSoup
import requests


def check_sign():
    your_birth_day = input("輸入您的生日的日期> ")
    your_birth_month = input("輸入你生日的月份> ")
    if (int(your_birth_month) == 12 and int(your_birth_day) >= 22) or (
        int(your_birth_month) == 1 and int(your_birth_day) = 19
    ):
        sign = "Capricorn"
    elif (int(your_birth_month) == 1 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 2 and int(your_birth_day) = 17
    ):
        sign = "Aquarium"
    elif (int(your_birth_month) == 2 and int(your_birth_day) >= 18) or (
        int(your_birth_month) == 3 and int(your_birth_day) = 19
    ):
        sign = "Pices"
    elif (int(your_birth_month) == 3 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 4 and int(your_birth_day) = 19
    ):
        sign = "Aries"
    elif (int(your_birth_month) == 4 and int(your_birth_day) >= 20) or (
        int(your_birth_month) == 5 and int(your_birth_day) = 20
    ):
        sign = "Taurus"
    elif (int(your_birth_month) == 5 and int(your_birth_day) >= 21) or (
        int(your_birth_month) == 6 and int(your_birth_day) = 20
    ):
        sign = "Gemini"
    elif (int(your_birth_month) == 6 and int(your_birth_day) >= 21) or (
        int(your_birth_month) == 7 and int(your_birth_day) = 22
    ):
        sign = "Cancer"
    elif (int(your_birth_month) == 7 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 8 and int(your_birth_day) = 22
    ):
        sign = "Leo"
    elif (int(your_birth_month) == 8 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 9 and int(your_birth_day) = 22
    ):
        sign = "Virgo"
    elif (int(your_birth_month) == 9 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 10 and int(your_birth_day) = 22
    ):
        sign = "Libra"
    elif (int(your_birth_month) == 10 and int(your_birth_day) >= 23) or (
        int(your_birth_month) == 11 and int(your_birth_day) = 21
    ):
        sign = "Scorpio"
    elif (int(your_birth_month) == 11 and int(your_birth_day) >= 22) or (
        int(your_birth_month) == 12 and int(your_birth_day) = 21
    ):
        sign = "Sagittarius"

    return sign


def horoscope(zodiac_sign: int, day: str) -> str:
    url = (
        "https://www.horoscope.com/us/horoscopes/general/"
        f"horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"
    )
    soup = BeautifulSoup(requests.get(url).content, "html.parser")
    return soup.find("div", class_="main-horoscope").p.text


if __name__ == "__main__":
    print("Daily Horoscope. \n")
    print(
        "輸入你的星座號碼:\n",
        "1. Aries\n",
        "2. Taurus\n",
        "3. Gemini\n",
        "4. Cancer\n",
        "5. Leo\n",
        "6. Virgo\n",
        "7. Libra\n",
        "8. Scorpio\n",
        "9. Sagittarius\n",
        "10. Capricorn\n",
        "11. Aquarius\n",
        "12. Pisces\n",
        "\n或者,如果您不確定自己的星座,請輸入'calculate'",
    )
    zodiac_sign = input("number> ")
    if zodiac_sign != "calculate":
        print("choose some day:\n", "yesterday\n", "today\n", "tomorrow\n")
        day = input("enter the day> ")
        horoscope_text = horoscope(zodiac_sign, day)
        print(horoscope_text)
    else:
        print("\n好的,別擔(dān)心。很快你就會通過這個小測驗")
        print("\n恭喜!你絕對是", check_sign())

到此這篇關(guān)于python爬蟲竟然被小伙用來算命的文章就介紹到這了,更多相關(guān)python爬蟲算命內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • js日期、星座的級聯(lián)顯示代碼
  • javascript計算星座屬相(十二生肖屬相)示例代碼
  • php根據(jù)日期或時間戳獲取星座信息和生肖等信息
  • php根據(jù)日期顯示所在星座的方法
  • 根據(jù)出生日期自動取得星座的js代碼
  • python實現(xiàn)根據(jù)月份和日期得到星座的方法
  • jQuery實現(xiàn)根據(jù)生日計算年齡 星座 生肖
  • 使用php從身份證號中獲取一系列線索(星座、生肖、生日等)

標(biāo)簽:漯河 普洱 南平 海南 大同 林芝 盤錦 寧夏

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《python爬蟲竟然被小伙用來算命》,本文關(guān)鍵詞  python,爬蟲,竟然,被,小伙,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《python爬蟲竟然被小伙用來算命》相關(guān)的同類信息!
  • 本頁收集關(guān)于python爬蟲竟然被小伙用來算命的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃
    免费看欧美美女黄的网站| 欧美精品高清视频| 国产精品女同一区二区三区| 九九视频精品免费| 久久精品欧美一区二区三区麻豆| 国产精品一级片在线观看| 中文字幕av一区二区三区高 | 成人小视频免费在线观看| 久久久久久电影| 成人av集中营| 亚洲综合偷拍欧美一区色| 欧美日韩一级二级三级| 美国十次综合导航| 国产女同性恋一区二区| 91蜜桃网址入口| 日本午夜精品视频在线观看 | 成人免费视频国产在线观看| 亚洲另类色综合网站| 在线不卡欧美精品一区二区三区| 久久成人av少妇免费| 中文字幕av资源一区| 欧美体内she精高潮| 日本aⅴ亚洲精品中文乱码| 久久久99免费| 欧洲国内综合视频| 国产又粗又猛又爽又黄91精品| 国产精品国产精品国产专区不蜜 | 亚洲精品网站在线观看| 欧美乱妇23p| 粉嫩13p一区二区三区| 亚洲一卡二卡三卡四卡| 亚洲精品一区二区在线观看| 色婷婷综合五月| 蜜臀av一级做a爰片久久| 国产精品萝li| 欧美一区二区三区思思人| 不卡一区二区三区四区| 毛片基地黄久久久久久天堂| 亚洲人妖av一区二区| 337p日本欧洲亚洲大胆色噜噜| 91在线视频官网| 国产在线精品国自产拍免费| 亚洲一二三四在线| 国产精品乱码一区二三区小蝌蚪| 制服.丝袜.亚洲.另类.中文| 精品视频色一区| 国产激情视频一区二区三区欧美| 亚洲国产wwwccc36天堂| 国产精品乱子久久久久| 久久久久久一级片| 欧美精品一二三四| 色综合色综合色综合| 国产精品1024久久| 久久99国内精品| 香蕉成人啪国产精品视频综合网 | 久久女同互慰一区二区三区| 欧美理论电影在线| 日本乱人伦aⅴ精品| bt欧美亚洲午夜电影天堂| 国产主播一区二区三区| 日韩va欧美va亚洲va久久| 亚洲一线二线三线视频| 亚洲精品国久久99热| 日韩一区有码在线| 国产精品无人区| 欧美激情一区二区三区四区| 久久人人97超碰com| 欧美成人艳星乳罩| 日韩精品一区二区三区四区| 欧美一区二区精品在线| 欧美一区二区在线播放| 欧美顶级少妇做爰| 制服丝袜在线91| 欧美一区二区久久久| 日韩欧美在线网站| 日韩一区二区免费电影| 欧美一级二级三级蜜桃| 日韩一区二区电影网| 日韩午夜av电影| 精品久久久久久无| 久久久精品中文字幕麻豆发布| 日韩精品一区二| 久久欧美一区二区| 天天综合天天综合色| 中文字幕一区日韩精品欧美| 亚洲欧美综合色| 亚洲欧美国产77777| 中文字幕一区二区三| 亚洲免费在线播放| 亚洲一区二区3| 五月天丁香久久| 精品中文字幕一区二区| 国产精品一级二级三级| 国产成人小视频| eeuss鲁片一区二区三区| 色综合天天综合网国产成人综合天| 91色综合久久久久婷婷| 99久久亚洲一区二区三区青草| 久久97超碰色| 国产成人午夜视频| 91香蕉视频污| 欧美夫妻性生活| 久久久久久久久岛国免费| 国产精品第五页| 香蕉成人啪国产精品视频综合网| 久久国产综合精品| 成人黄页毛片网站| 欧美日韩国产综合一区二区三区| 欧美一区二区大片| 久久久一区二区三区| 亚洲精品免费在线| 蜜臀av国产精品久久久久| 风间由美一区二区三区在线观看| 91久久免费观看| 日韩欧美二区三区| 亚洲欧美在线另类| 狠狠网亚洲精品| 一本一本久久a久久精品综合麻豆| 欧美电影影音先锋| 国产精品美女久久久久av爽李琼| 亚洲成av人片观看| 岛国精品在线观看| 91麻豆精品91久久久久久清纯| 日本一区二区免费在线| 亚洲成人一二三| 国产成人免费在线观看不卡| 国产精品一区二区视频| 一本色道久久综合亚洲91| 欧美成人精品福利| 一区二区在线电影| 国产激情视频一区二区三区欧美| 欧美日韩亚州综合| 国产欧美精品一区二区色综合 | 一区二区三区在线看| 久久精品国产久精国产| 在线中文字幕一区| 国产精品三级电影| 久久电影国产免费久久电影| 在线视频国产一区| 国产精品视频在线看| 久久99精品久久久| 欧美一卡二卡在线观看| 亚洲影院在线观看| 色美美综合视频| 国产精品久久久久一区二区三区| 久久99国产精品免费网站| 欧美日韩黄色影视| 亚洲在线成人精品| 91在线国产福利| 国产精品国模大尺度视频| 成人av高清在线| 婷婷中文字幕综合| 99精品视频在线免费观看| 精品精品欲导航| 青青草精品视频| 欧美日韩aaaaaa| 一区二区三区四区av| 91在线视频免费91| 亚洲女同ⅹxx女同tv| 粉嫩av一区二区三区| 欧美国产一区二区在线观看| 国产一区二区美女| 久久久久久久性| 国产乱人伦偷精品视频免下载| 日韩欧美国产一区在线观看| 日本成人在线视频网站| 欧美一区二区三区免费在线看| 亚洲成av人综合在线观看| 欧美三区在线视频| 五月激情六月综合| 91精品国产一区二区三区香蕉| 日韩福利视频网| 欧美一级xxx| 国产一区二区三区视频在线播放| 亚洲精品一区二区三区精华液 | 国产69精品一区二区亚洲孕妇| 欧美精品一区二区三区蜜桃 | 一区二区三区高清| 欧洲色大大久久| 午夜国产精品一区| 欧美一区二区三区日韩| 精品一区二区三区免费播放| 久久精品亚洲一区二区三区浴池 | 久久久久久久网| 波多野结衣精品在线| 伊人一区二区三区| 制服.丝袜.亚洲.另类.中文| 精品一区二区三区日韩| 中文在线一区二区| 欧美自拍偷拍午夜视频| 日本欧美韩国一区三区| 久久婷婷成人综合色| 成人爽a毛片一区二区免费| 夜夜嗨av一区二区三区| 91.xcao| 国产精品影视网| 一区二区三区日韩在线观看| 欧美一区欧美二区| 国产jizzjizz一区二区| 久色婷婷小香蕉久久|