[[Template core/front/global/updateWarning is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
من فضلتكم احاول ان استخرج النص من class ولكنى فشلت
the element
<div id="cp-0" class="caption-line" data-time="19.5">
<div class="caption-line-time">0:19</div>
<div class="caption-line-text">I used to bite my tongue and hold my breath Scared to rock the boat and make a mess</div>
</div>
<div id="cp-1" class="caption-line" data-time="24.7">
<div class="caption-line-time">0:24</div>
<div class="caption-line-text">So I sat quietly, agreed politely</div>
</div>
بمعنى ان id بيتغير بس class value ثابته
انا اريد ان احصل على هذا
0:19
I used to bite my tongue and hold my breath Scared to rock the boat and make a mess
0:24
So I sat quietly, agreed politely
وهكذا الى ان ينتهي html element
حاولت الاتي
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
Dim elems As HtmlElementCollection
elems = WebBrowser1.Document.GetElementsByTagName("div")
For Each elem As HtmlElement In elems
Dim classstr As String = elem.GetElementsByTagName("class")
If ((classstr IsNot Nothing) And (classstr.Length <> 0)) Then
If classstr.ToLower().Equals(" caption-line-time ") Then
Dim conStr As String = elem.GetAttribute("content")
PrintLine(1, conStr)
ElseIf classstr.ToLower().Equals("caption-line-text") Then
Dim conStr As String = elem.GetAttribute("content")
PrintLine(1, conStr)
End If
End If
Next
تم النشر منذ
السلام عليكم
من فضلتكم احاول ان استخرج النص من class ولكنى فشلت
the element
<div id="cp-0" class="caption-line" data-time="19.5">
<div class="caption-line-time">0:19</div>
<div class="caption-line-text">I used to bite my tongue and hold my breath Scared to rock the boat and make a mess</div>
</div>
<div id="cp-1" class="caption-line" data-time="24.7">
<div class="caption-line-time">0:24</div>
<div class="caption-line-text">So I sat quietly, agreed politely</div>
</div>
بمعنى ان id بيتغير بس class value ثابته
انا اريد ان احصل على هذا
0:19
I used to bite my tongue and hold my breath Scared to rock the boat and make a mess
0:24
So I sat quietly, agreed politely
وهكذا الى ان ينتهي html element
حاولت الاتي
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
Dim elems As HtmlElementCollection
elems = WebBrowser1.Document.GetElementsByTagName("div")
For Each elem As HtmlElement In elems
Dim classstr As String = elem.GetElementsByTagName("class")
If ((classstr IsNot Nothing) And (classstr.Length <> 0)) Then
If classstr.ToLower().Equals(" caption-line-time ") Then
Dim conStr As String = elem.GetAttribute("content")
PrintLine(1, conStr)
ElseIf classstr.ToLower().Equals("caption-line-text") Then
Dim conStr As String = elem.GetAttribute("content")
PrintLine(1, conStr)
End If
End If
Next
حتى استبدلت elem.GetAttribute("content") ب
elem.innertext
ولكن نفس المشكله
معلش طولت وشكرا
شارك هذا الرد
رابط المشاركة
شارك الرد من خلال المواقع ادناه