Beispiel #1
0
        public static void AddToCrawl(YouTubeLink link)
        {
            var path = "watch?v=" + link.Path;
            var yt   = new YouTube(path);

            Crawler.RegisterSite(yt);
        }
Beispiel #2
0
        public async Task <IActionResult> PutYouTubeLink(int id, YouTubeLink youTubeLink)
        {
            if (id != youTubeLink.Id)
            {
                return(BadRequest());
            }

            _context.Entry(youTubeLink).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!YouTubeLinkExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
        public async Task <ActionResult <YouTubeLink> > PostYouTubeLink(YouTubeLink youTubeLink)
        {
            // _context.Links.Add(youTubeLink);
            // await _context.SaveChangesAsync();

            CrawlerManager.AddToCrawl(youTubeLink);

            return(CreatedAtAction(nameof(GetYouTubeLink), new { id = youTubeLink.Id }, youTubeLink));
        }
Beispiel #4
0
 /// <summary>
 /// Opens the song at YouTube.com in a new tab
 /// </summary>
 public static void GoToYouTube()
 {
     YouTubeLink.Click();
 }