网站与BS4刮:无法获取表(Web scraping with BS4: unable to get table)

当您在浏览器中打开下面的URL时,

http://www.kianfunds2.com/%D8%A7%D8%B1%D8%B2%D8%B4-%D8%AF%D8%A7%D8%B1%D8%A7%DB%8C%DB% 8C-%D9%87%D8%A7-%D9%88-%D8%AA%D8%B9%D8%AF%D8%A7%D8%AF-%D9%88%D8%A7%D8%AD% D8%AF-%D9%87%D8%A7

你会看到一个名为“复制”的紫色图标。 当您选择此图标(“复制”)时,您将获得一个完整的表格,您可以将其粘贴到Excel中。 我怎样才能得到这个表作为Python中的输入?

我的代码在下面,它什么也没有显示:

import requests
from bs4 import BeautifulSoup
url = "http://www.kianfunds2.com/" + "ارزش-دارایی-ها-و-تعداد-واحد-ها"
result = requests.get(url)
soup = BeautifulSoup(result.content, "html.parser")
table = soup.find("a", class_="dt-button buttons-copy buttons-html5")

我不想使用Selenium,因为它需要很长时间。 请使用美丽的汤。


When you open the URL below in a browser,

http://www.kianfunds2.com/%D8%A7%D8%B1%D8%B2%D8%B4-%D8%AF%D8%A7%D8%B1%D8%A7%DB%8C%DB%8C-%D9%87%D8%A7-%D9%88-%D8%AA%D8%B9%D8%AF%D8%A7%D8%AF-%D9%88%D8%A7%D8%AD%D8%AF-%D9%87%D8%A7

you see a purple icon by the name of "copy". When you select this icon("copy"), you will achieve a complete table that you can paste into Excel. How can I get this table as an input in Python?

My code is below, and it shows nothing:

import requests
from bs4 import BeautifulSoup
url = "http://www.kianfunds2.com/" + "ارزش-دارایی-ها-و-تعداد-واحد-ها"
result = requests.get(url)
soup = BeautifulSoup(result.content, "html.parser")
table = soup.find("a", class_="dt-button buttons-copy buttons-html5")

I don't want use Selenium, because it takes a lot of time. Please use Beautiful Soup.


原文:https://stackoverflow.com/questions/49362391
2022-01-12 12:01

相关问答

更多

使用excel VBA更改图表和图例的方向(Change orientation of chart and legend using excel VBA)

您的列和行是相反的。 选择图表后,请转到“设计”上下文选项卡,然后单击“切换行/列”。 这样可以解决吗? 如果是,您可以使用: ActiveChart.PlotBy = xlRows or ActiveChart.PlotBy = xlColumns 以编程方式进行。 Your columns and rows are reversed. When you have the chart selected go und "Design" contextual tab and click "Sw...

Excel图表 - 没有传说(Excel chart - Not getting Legends)

尝试迭代系列集合并逐个设置名称。 像这样的东西: foreach (Series series in myChart.SeriesCollection()){ series.Name = "MyName"; } Try to iterate over series collection and set the names one by one. Something like this: foreach (Series series in myChart.SeriesCollection()...

将图表图例条目格式与Excel中的源数据匹配(Match chart legend entry formatting to source data in Excel)

也许不理想,但它的确有效。 只需从数据源中删除图例标签,然后在其格式符合您喜欢的位置插入 - > shape - >文本框。 我想你想要的附图示例。 **免责声明:此图表绝对没有任何意义。 Maybe not ideal, but it works. Just delete the legend label from your data source and then insert -> shape -> text box in its place that is formatted to you...

如何使用C#在Excel中选择现有图表(How to select existing Chart in Excel using C#)

要在Excel中选择活动图表,可以使用此代码 Excel.ChartObject chartObject11 = (Excel.ChartObject)Ws.ChartObjects(1); chartObject11.Activate(); 基于此可以编辑图表并格式化它。就像更改其数据范围或格式化其颜色或高度或宽度等。 希望这可以帮助 To select an active chart in excel one can use this code Excel.ChartObject chart...

如何更改图例条目的形状?(How to change the shape of legend entry?)

您可以使用item1.ImageStyle = LegendImageStyle.Line来创建实线。 更多信息在这里 然而,据我所知,没有“破折号”风格,但可以使用图像作为符号。 所以你可以尝试制作一个虚线的小图像并阅读它 。 我希望它有所帮助。 You can use item1.ImageStyle = LegendImageStyle.Line to create a solid line. More info here However there is no "dash" style a...

我在使用C#创建Excel图表时遇到问题(I am having problems in creating excel chart using C#)

在调用xlCharts.Add(10, 80,500,200) , 10,80是相对于A1单元的点的期望位置的坐标。 In the call xlCharts.Add(10, 80,500,200), 10,80 are the coordinates of the desired position in points, relative to A1 cell.

如何在C#中使图表图例项交互(How to make Chart Legend Items interactive in C#)

最后找到了答案......在这里发布代码,以便对其他人有所帮助。 private void HeapStatsChart_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { HitTestResult result = HeapStatsChart.HitTest(e.X, e.Y); if (result != null && result.Object...

如何设置TickLabels的边框颜色excel图表c#(How to set border color of TickLabels excel chart c#)

通过假设你想要我通过评论建议的东西,而不在其余的代码中详细说明(只是快速建议:更好地删除GC部分); 这就是你所追求的: axis = (Axis)chartPage.Axes(XlAxisType.xlCategory); axis.MajorTickMark = XlTickMark.xlTickMarkNone; axis.Format.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse; 此代码指的是X轴:第二行删除主刻度线...

使用c#创建多个Excel图表对象(Creating multiple Excel chart objects using c#)

我的问题是Excel中的Chart对象实际上是图表工作表,而图表本身是ChartObject对象,并且您使用它所在的Shape对象来处理它。 这是一个链接 , 另一个关于它的abit,以及来自这个MS链接的一些VBA代码显示了一点,请注意有几种不同的方法来完成它: Sub AddChart_Excel() Dim objShape As Shape ' Create a chart and return a Shape object reference. ' The...

如何在C#中获取图表的Excel XValue(How to get Excel XValue of a Chart in C#)

尝试这个: var chart = chartObj.Chart as Excel.Chart; var s = chart.SeriesCollection(1) as Excel.Series; var xValues = (s.XValues as object) as Array; foreach (var xVal in xValues) { MessageBox.Show(xVal.ToString()); } 还有什么是我用COM互操作得到的`Object [*]`类型...

相关文章

更多

Unable to load configuration.

严重: Exception starting filter struts2 Unable to lo ...

table-Oceanus配置说明

作用: 描述具体的表规则 属性: name – 声明 table 名字,当命中 sql 中的 tabl ...

Guava集合工具类-Table接口映射处理

System.out.println("Emp&nbsp

英特尔推出Hadoop免费版本 布局BS时代

在近期于北京举办的2012年Hadoop与大数据技术大会上,Intel公司正式在中国宣布推出Intel ...

求教一个 table的css

想要实现这个一个Table,table的padding和下面的黑线一直实现不了,求各位大牛指点。 ...

Guava学习笔记:Guava新集合-Table等

  Table   当我们需要多个索引的数据结构的时候,通常情况下,我们只能用这种丑陋的Map< ...

div中table100%宽度的浏览器兼容性问题

先上代码,请看: <!DOCTYPE HTML PUBLIC "-//W3C//DTD ...

Web scraper open source

ByadminOnSeptember 10, 2012·Add Comment ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本