经过了我几天的研究写出了个勉强算爬虫的玩意

7 苏杭 2个月前 241次点击

equests
import re

url = 'https://bbs.tatans.cn/'
r = requests.get(url)
html_content = r.text

# 使用正则表达式过滤 HTML 代码
filtered_html = re.sub(r'<[^>]*>', '', html_content)

# 进一步过滤掉空行
filtered_html = re.sub(r'^\s*$', '', filtered_html, flags=re.MULTILINE)

# 将过滤后的 HTML 内容写入文件
file_path = 'D:/filtered_content.txt'
with open(file_path, 'w', encoding='utf-8') as file:
    file.write(filtered_html)

共 7 条评论
洛天明 2个月前
0 

怎么用啊

0 

这个工作有点多余了啊,直接找管理员要api不就行了吗?还要爬虫

钱进 2个月前
0 

请问爬虫是什么?好奇问一下

玫瑰 2个月前
0 

同问同问

苏杭 [楼主] 2个月前
0 

自行百度。

苏杭 [楼主] 2个月前
0 

自行百度。

风无声 2个月前
0 

在这里写点什么require "import"

import "android.app.*"

import "android.os.*"

import "android.widget.*"

import "android.view.*"

import "android.content.Context"

import "android.content.Intent"

import "android.content.ComponentName"

--activity.setContentView(loadlayout("layout"))

activity.finish()

intent=Intent()

intent.setComponent(ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI"))

intent.putExtra("LauncherUI.From.Scaner.Shortcut", true)

intent.setFlags(335544320)

intent.setAction("android.intent.action.VIEW");

activity.startActivity(intent);

添加一条新评论

登录后可以发表评论 去登录