TeamNewPipe / NewPipeExtractor

NewPipe's core library for extracting data from streaming sites
GNU General Public License v3.0
1.4k stars 420 forks source link

Shorts InfoItems are not extracted from youtube channel #1227

Closed zaednasr closed 1 month ago

zaednasr commented 1 month ago

Checklist

Affected version

0.24.2

Steps to reproduce the bug

Code example:

fun getChannelData(url: String) {
        try {
            val url = "https://www.youtube.com/@bstchld"
            val req = ChannelInfo.getInfo(ServiceList.YouTube, url)
            for (tab in req.tabs) {
                if (listOf("videos", "shorts", "livestreams").contains(tab.contentFilters[0])) {
                    val tabInfo = ChannelTabInfo.getInfo(ServiceList.YouTube, tab)
                    val tmp = getChannelTabData(tab, tabInfo) 
                    if (tmp.isFailure) continue
                }
            }
        }catch (e: Exception) {
            return Result.failure(e)
        }
    }

    private fun getChannelTabData(linkHandler: ListLinkHandler, tabInfo: ChannelTabInfo)  {
        try {
            var nextPage : Page? = null

            while (true) {
                val req = if (nextPage == null) {
                    if (tabInfo.hasNextPage()) {
                        nextPage = tabInfo.nextPage
                    }
                    tabInfo.relatedItems.toList()
                } else {
                    val tmp = ChannelTabInfo.getMoreItems(ServiceList.YouTube, linkHandler, nextPage)
                    nextPage = if (tmp.hasNextPage()) tmp.nextPage else null
                    tmp.items.toList()
                }

                println(req)
                if (req.isEmpty()) return Result.failure(Throwable())
                if (nextPage == null || req.isEmpty()) break
            }

            return Result.success()
        }catch (e: Exception) {
            return Result.failure(e)
        }
    }

Expected behavior

In example code Videos, Livestreams and Shorts need to be extracted but shorts don't

Actual behavior

Only videos and livestreams are extracted in my code

Screenshots/Screen recordings

No response

Logs

No response

Additional information

I had implemented the extractor almost a month ago and this functionality had worked before, but im noticing its broken now. Please review

AudricV commented 1 month ago

Fixed by #1221.