婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

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

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

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

前言

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

開搞!

1.網(wǎng)站分析

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

大家就能看到這個(gè)頁面了

我們今天呢,就先做一個(gè)通過星座來得知三天的運(yùn)勢的小玩意,

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

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


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

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

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

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

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

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

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

2.獲取內(nèi)容

從圖片我們可以得到我們所需的內(nèi)容,這個(gè)是很基礎(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)容——來自上天的指示

如果有小伙伴不知道自己的星座怎么辦呢,所以我們就還需要一個(gè)函數(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.實(shí)操


怎么樣?很有趣吧,當(dāng)然網(wǎng)站有很多的用處,等以后我會繼續(xù)更新,實(shí)現(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)心。很快你就會通過這個(gè)小測驗(yàn)")
        print("\n恭喜!你絕對是", check_sign())

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

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

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

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《python爬蟲竟然被小伙用來算命》,本文關(guān)鍵詞  python,爬蟲,竟然,被,小伙,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《python爬蟲竟然被小伙用來算命》相關(guān)的同類信息!
  • 本頁收集關(guān)于python爬蟲竟然被小伙用來算命的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av
    欧美亚洲综合一区| 国产精品婷婷午夜在线观看| 69久久夜色精品国产69蝌蚪网| 国产欧美一区二区精品婷婷| 九一九一国产精品| 日韩精品一区国产麻豆| 免费三级欧美电影| 日韩免费观看高清完整版| 蜜桃视频在线一区| 日韩精品中文字幕在线不卡尤物| 首页国产欧美日韩丝袜| 欧美欧美欧美欧美| 久久精品国产亚洲aⅴ| 26uuu另类欧美亚洲曰本| 国产一区二区三区免费看| 日本一区二区综合亚洲| 欧美亚洲禁片免费| 精品一区二区成人精品| 国产欧美日韩视频一区二区 | 国产在线日韩欧美| 日本精品裸体写真集在线观看 | 久久 天天综合| 久久综合九色综合97_久久久 | 免费成人在线影院| 国产色婷婷亚洲99精品小说| 97久久超碰国产精品| 亚洲二区在线观看| 久久久亚洲欧洲日产国码αv| 成人中文字幕电影| 亚洲h精品动漫在线观看| 亚洲精品在线观看视频| 99国产精品国产精品毛片| 日韩主播视频在线| 中国av一区二区三区| 欧美喷水一区二区| 91视频一区二区三区| 美女视频免费一区| 中文字幕亚洲欧美在线不卡| 8v天堂国产在线一区二区| 成人精品鲁一区一区二区| 日韩精品每日更新| 亚洲乱码国产乱码精品精小说| 欧美一区二区三区啪啪| 91捆绑美女网站| 国产成人av一区二区三区在线 | 91年精品国产| 麻豆精品蜜桃视频网站| 一区二区三区精品视频在线| 日本一区二区三区四区| 日韩一区二区免费在线观看| 99久久精品国产网站| 国产精品一二三四| 日韩中文欧美在线| 天天综合色天天综合| 亚洲精品视频在线看| 一区在线中文字幕| 国产精品久久久久影院色老大| 精品国产3级a| 亚洲精品一线二线三线| 欧美一区二区黄色| 欧美日韩电影在线| 欧美三级视频在线| 在线这里只有精品| 欧美优质美女网站| 在线观看不卡视频| 欧美色偷偷大香| 欧美精品视频www在线观看| 欧美在线观看禁18| 欧美日本视频在线| 日韩欧美国产电影| 日欧美一区二区| 色婷婷精品久久二区二区蜜臂av | 天天爽夜夜爽夜夜爽精品视频| 国产精品国模大尺度视频| 久久精品一区二区三区不卡| 国产亚洲欧美激情| 中文字幕二三区不卡| 欧美激情自拍偷拍| 中文在线一区二区| 亚洲少妇中出一区| 亚洲成人自拍网| 美女网站在线免费欧美精品| 久久精品国产精品亚洲红杏| 狠狠色综合日日| 成人午夜视频在线观看| 成熟亚洲日本毛茸茸凸凹| 欧美刺激午夜性久久久久久久| 国产大片一区二区| 国产一区二区成人久久免费影院| 日韩理论片一区二区| 成人欧美一区二区三区白人| 亚洲精品国久久99热| 亚洲成人综合视频| 国模娜娜一区二区三区| 99re这里只有精品首页| 欧美日韩中文国产| 久久理论电影网| 亚洲国产精品久久不卡毛片| 男女性色大片免费观看一区二区 | 亚洲午夜av在线| 久久99热狠狠色一区二区| 久久久久久久综合日本| 蜜臀91精品一区二区三区| 91精品久久久久久久99蜜桃| 日韩av一区二| 国产激情一区二区三区四区| 91丨porny丨户外露出| 日韩一区二区视频| 国产精品色一区二区三区| 一区二区三区91| 国产乱码精品一区二区三区忘忧草 | 91免费看片在线观看| 67194成人在线观看| 成人免费在线播放视频| 蜜臀久久久99精品久久久久久| 不卡视频在线观看| 精品国产免费人成在线观看| 亚洲综合在线五月| 国产成人精品亚洲日本在线桃色 | 99视频在线精品| 日韩欧美精品三级| 日韩中文字幕1| 91国偷自产一区二区开放时间| 国产亚洲视频系列| 美脚の诱脚舐め脚责91| 欧美亚洲国产怡红院影院| 国产精品久久久久久久午夜片| 精品一区二区三区欧美| 欧美视频三区在线播放| 亚洲视频中文字幕| 成人黄色网址在线观看| 久久天堂av综合合色蜜桃网| 九色porny丨国产精品| 欧美一区二区精品在线| 秋霞影院一区二区| 3d动漫精品啪啪一区二区竹菊| 一区二区三区中文字幕| 五月天中文字幕一区二区| 国产精品久久久久影视| 欧美人体做爰大胆视频| 亚洲天堂av一区| 成年人国产精品| 中文字幕欧美国产| 丰满岳乱妇一区二区三区| 国产欧美日韩在线看| 成人污视频在线观看| 国产精品久久久久7777按摩 | 日本不卡高清视频| 欧美一区二区在线免费播放| 午夜不卡av免费| 欧美日韩另类一区| 日韩精品一二三四| 精品国产123| 丁香婷婷综合五月| 亚洲视频一二三| 在线观看中文字幕不卡| 亚洲国产欧美在线人成| 欧美一区二区在线免费播放| 激情文学综合丁香| 中文字幕一区在线| 欧美人妖巨大在线| 国产69精品久久久久毛片 | 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 久久老女人爱爱| 91在线观看美女| 日日骚欧美日韩| 欧美高清在线一区二区| 99re亚洲国产精品| 日产精品久久久久久久性色| 国产三级欧美三级| 在线观看欧美日本| 国产一区二区影院| 亚洲小少妇裸体bbw| 久久精品欧美日韩| 欧美在线综合视频| 国产成人精品三级麻豆| 日韩在线一二三区| 国产毛片精品视频| 精品国产91洋老外米糕| 洋洋成人永久网站入口| 久久女同性恋中文字幕| 欧洲激情一区二区| 激情五月激情综合网| 亚洲高清视频在线| 精品国产伦理网| 在线观看亚洲a| 懂色av噜噜一区二区三区av| 蜜臀99久久精品久久久久久软件| 国产精品视频yy9299一区| 精品久久人人做人人爽| 日本乱人伦一区| 成人一区二区三区视频在线观看 | 国产在线视频一区二区| 亚洲r级在线视频| 欧美国产日韩一二三区| 91精品婷婷国产综合久久竹菊| 日本道色综合久久| 97se亚洲国产综合自在线观| 高清成人在线观看| 国产乱码精品一区二区三区忘忧草|