Running each thread with one function.



  • I am building a news article scanning tool for over 100 online news websites to check if newly published articles contain specific keywords that I provide.

    I have written a separate function for each news website. How can I run these functions in multiple threads, for example, running 5 threads at a time corresponding to 5 news websites until all websites are processed, and then starting over from the beginning?



  • There are many ways, here is one.
    Set thread number is 5, run type is Repeat.
    Create a txt file with 100 lines, each line is a data to specify the name of the website you want to crawl.
    For each website, create a function to scan the corresponding data.
    Create a resource of the form LinesFromFile (Use each line any number of times).

    When reading data, for each line received, use the "IF" command to check.
    For example, with 1 line in the txt file I denoted by cnn, so when I receive this data, I will execute the corresponding "Call function" command "cnn".
    Same goes for the remaining 99 lines, with the other "Call function" commands.
    alt text
    So, when it's done 100 websites, with the initial resource data settings, it will run from the beginning.



  • Thank bro nhiều, có hội nhóm BAS của ae Việt Nam giao lưu không bác ?



  • @ptt-bds à chào bác, hiện mình không có tham gia nhóm nào về BAS hết bạn, m tự nghiên cứu + tham gia diễn đàn + kết hợp với 1 số pro thôi bác à.


Log in to reply