Instead of looping on items where we expect only one to be, we just use items[0]
				
					
				
			This commit is contained in:
		
							
								
								
									
										19
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								main.cpp
									
									
									
									
									
								
							@@ -313,10 +313,7 @@ void treatChannelOrVideo(unsigned short threadId, bool isChannel, string id, str
 | 
				
			|||||||
        while(true)
 | 
					        while(true)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            json data = getJson(threadId, "channels?part=channels&id=" + id + (pageToken == "" ? "" : "&pageToken=" + pageToken), false, id),
 | 
					            json data = getJson(threadId, "channels?part=channels&id=" + id + (pageToken == "" ? "" : "&pageToken=" + pageToken), false, id),
 | 
				
			||||||
                 items = data["items"];
 | 
					                 channelSections = data["items"][0]["channelSections"];
 | 
				
			||||||
            for(const auto& item : items)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                json channelSections = item["channelSections"];
 | 
					 | 
				
			||||||
            for(const auto& channelSection : channelSections)
 | 
					            for(const auto& channelSection : channelSections)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                for(const auto& sectionChannel : channelSection["sectionChannels"])
 | 
					                for(const auto& sectionChannel : channelSection["sectionChannels"])
 | 
				
			||||||
@@ -334,17 +331,14 @@ void treatChannelOrVideo(unsigned short threadId, bool isChannel, string id, str
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                        goto breakChannelsTreatment;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                    goto breakChannelsTreatment;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
breakChannelsTreatment:
 | 
					 | 
				
			||||||
        ;
 | 
					 | 
				
			||||||
        // `COMMUNITY`
 | 
					        // `COMMUNITY`
 | 
				
			||||||
        pageToken = "";
 | 
					        pageToken = "";
 | 
				
			||||||
        while(true)
 | 
					        while(true)
 | 
				
			||||||
@@ -410,11 +404,9 @@ breakChannelsTreatment:
 | 
				
			|||||||
        while(true)
 | 
					        while(true)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            json data = getJson(threadId, "channels?part=playlists&id=" + id + (pageToken == "" ? "" : "&pageToken=" + pageToken), false, id),
 | 
					            json data = getJson(threadId, "channels?part=playlists&id=" + id + (pageToken == "" ? "" : "&pageToken=" + pageToken), false, id),
 | 
				
			||||||
                 items = data["items"];
 | 
					                 playlistSections = data["items"][0]["playlistSections"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for(const auto& item : items)
 | 
					            for(const auto& playlistSection : playlistSections)
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                for(const auto& playlistSection : item["playlistSections"])
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                for(const auto& playlist : playlistSection["playlists"])
 | 
					                for(const auto& playlist : playlistSection["playlists"])
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -464,7 +456,6 @@ breakChannelsTreatment:
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if(!data["nextPageToken"].is_null())
 | 
					            if(!data["nextPageToken"].is_null())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                pageToken = data["nextPageToken"];
 | 
					                pageToken = data["nextPageToken"];
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user