簡易 shell 爬搜狐

2021-10-25 09:50:27 字數 652 閱讀 3500

放檔案裡直接跑會報錯,複製貼上執行吧

注:僅做學習使用

關鍵點如下:

1.首先通過搜尋頁面獲取到 url ,需自己補上 https: 示例如下:

2.然後通過對鏈結後一部分進行 base64 解密獲取 vid

base64 -d "dxmvmzqwotkxmjgwlzeznzuzodqxns5zahrtba=="

有些可以直接通過 vid ,時間輟(毫秒)來直接獲取,裡邊會包含乙個完整的 mp4 的鏈結,如下

還有一些通過上邊獲取到乙個不完整的鏈結,需要多進行一步來獲取 mp4 鏈結,將不完整的鏈結替換如下的 new 引數即會獲取到完整的 mp4 鏈結

我的筆記如下:

for i in ;do get_url $i;done  # 獲取一堆 html 鏈結寫入 test.txt

for i in $(grep -eo "d[^\.]*" test.txt );do echo $i|base64 -d|grep -eo "[0-9]?\."|sed 's/\.//g';done >> test2.txt   # 根據 test.txt 獲取對應的 vid

paste test.txt test2.txt >> test3.txt  # 合併 test.txt 和 test2.txt,生成同時含有 鏈結 和 vid 的檔案

python爬取搜狐網的新聞

1 import requests 2from bs4 import beautifulsoup3 4 newsurl 5 用get方法進行網頁獲取 6 res requests.get newsurl 7 用utf 8的編碼方式 8 res.encoding utf 8 9 獲取網頁的內容,並用h...

青蛙爬井簡易C

題目描述 有一口深度為high公尺的水井,井底有乙隻青蛙,它每天白天能夠沿井壁向上爬up公尺,夜裡則順井壁向下滑down公尺,若青蛙從某個早晨開始向外爬,對於任意指定的high up和down值 均為自然數 計算青蛙多少天能夠爬出井口?輸入輸入3個正整數 high up和down。輸出輸出乙個整數,...

簡易shell的實現

自主minishell實現 1 獲取標準輸入 2 解析輸入得到 命令名 執行引數 3 建立子程序 子程序中進行程式替換 4 程序等待 include include include include include intmain printf uesr localhost fflush stdout...