Results 1 to 10 of 222

Thread: Notes tests, Scrapping, YouTube

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    #133 #post19765 https://excelfox.com/forum/showthrea...ge14#post19765









    just like all the other #xx3 posts in this Thread, using something like this…._

    Code:
    
    Sub GetPlayListLinksFromTextFileUsinghqdefaultjpg_DavKev()  '   look for this - hqdefault.jpg
    Rem 0a
    Dim WsDK As Worksheet:  Set WsDK = ThisWorkbook.Worksheets.Item("LearnDavKev")
    'Rem 0b) An Array of all the 9 text files got from the last macro   Sub WieGehtsYouTubeURLServerChromeHybridStep75_2()
    'Dim strTxts As String: Let strTxts = "WieGehtsYouTubePopularServerChromeindex_1.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_76.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_151.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_226.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_301.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_376.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_451.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_526.txt" & vbCr & vbLf & _
    '"WieGehtsYouTubePopularServerChromeindex_601.txt"
    'Dim Txts() As String: Let Txts() = Split(strTxts, vbCr & vbLf, 9, vbBinaryCompare)
        
    'Dim Cnt As Long
    '    For Cnt = LBound(Txts()) To UBound(Txts())    ' Loop all the text files got from the last macro   Sub WieGehtsYouTubeURLServerChromeHybridStep75_2() ==
        ' Rem 1 Get the text files as a long single string
    Dim FileNum As Long: Let FileNum = FreeFile(1)                                    ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName As String, TotalFile As String
     '                                             Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & "WieGehtsYouTubeServerChrome.txt"   '
    ' Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & "GettingStarted\" & Txts(Cnt)   ' "WieGehtsYouTubeServerChrome601.txt" ' "WieGehtsYouTubeServerChrome526.txt" ' "WieGehtsYouTubeServerChrome451.txt" ' "WieGehtsYouTubeServerChrome376.txt" ' "WieGehtsYouTubeServerChrome301.txt" ' "WieGehtsYouTubeServerChrome226.txt" ' "WieGehtsYouTubeServerChrome151.txt" '  "WieGehtsYouTubeServerChrome76.txt" '  '"WieGehtsYouTubeServerChrome1.txt"   '
     Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & "KevDev\" & "KevDevServerChromeindex_1.txt"                                           ' "WieGehtsYouTubeServerChrome601.txt" ' "WieGehtsYouTubeServerChrome526.txt" ' "WieGehtsYouTubeServerChrome451.txt" ' "WieGehtsYouTubeServerChrome376.txt" ' "WieGehtsYouTubeServerChrome301.txt" ' "WieGehtsYouTubeServerChrome226.txt" ' "WieGehtsYouTubeServerChrome151.txt" '  "WieGehtsYouTubeServerChrome76.txt" '  '"WieGehtsYouTubeServerChrome1.txt"   '
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundamental type data input...
    ' Let TotalFile = Space(LOF(FileNum)) '....and wot receives it has to be a string of exactly the right length
    'Get #FileNum, , TotalFile
    '  Or  http://www.eileenslounge.com/viewtopic.php?p=295782&sid=f6dcab07c4d24e00e697fe4343dc7392#p295782
     Let TotalFile = Input(LOF(FileNum), FileNum)
    Close #FileNum
    ' Rem 2 Get all links based on the unique bit of index=x, where x is 1 2 3 4 ...... etc
    '                   Dim Cnt As Long: Let Cnt = 1
    Dim TextBit As String: Let TextBit = TotalFile
    Dim posJpg As Long: Let posJpg = InStr(1, TextBit, "hqdefault.jpg", vbBinaryCompare)
        Do While posJpg <> 0
        Dim strURL As String: Let strURL = Mid(TextBit, posJpg - 12, 11)
        Dim Unics As String  '  This is mainly because sometimes the same 11 digit bit  appears a few times in a text file,    But Note that because I dont initialise / reset this then, unlike the previous code done once for each text file,  I will also catch the duplicates caused by me overlapping the URLs that I used, like , example at the start of the second main outer loop, the 76th 77th 78th and 79th would not get added
            If InStr(1, Unics, strURL, vbBinaryCompare) = 0 Then
             Let Unics = Unics & " " & strURL
             Dim Lr1 As Long: Let Lr1 = WsDK.Range("A" & WsDK.Rows.Count & "").End(xlUp).Row
             Dim Nr As Long
                If WsDK.Range("A1").Value = "" Then
                 Let Nr = 1
                Else
                 Let Nr = Lr1 + 1
                End If
             Let WsDK.Range("A" & Nr & "").Value = strURL
                
            Else ' Got a dup
    '             Let WsPop.Range("C" & Nr & "").Value = WsPop.Range("C" & Nr & "").Value + 1 ' for count of dups
            End If
         Let TextBit = Mid(TextBit, posJpg + 1)
         Let posJpg = InStr(1, TextBit, "hqdefault.jpg", vbBinaryCompare)
        Loop
    '    Next Cnt   '   ============================
    WsDK.Columns(1).AutoFit
    End Sub

    _... give something like this

    Note: quite a few more ( 26 ) than the 6 of the Play List
    Last edited by DocAElstein; 03-04-2023 at 03:25 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 03-26-2025, 02:56 AM
  2. Tests and Notes on Range Referrencing
    By DocAElstein in forum Test Area
    Replies: 70
    Last Post: 02-20-2024, 01:54 AM
  3. Tests and Notes for EMail Threads
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 11-15-2022, 04:39 PM
  4. Notes tests. Excel VBA Folder File Search
    By DocAElstein in forum Test Area
    Replies: 39
    Last Post: 03-20-2018, 04:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •