Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Number of lines in txt

$
0
0

I wrote this tonight so, I can, get the title, author and links for the top 50 results, in my keywords.txt it works perfectly, but I don't know how to make it tell me the total number of lines/links in the txt file when its finished, appreciate any help a lot.

 

$content = Get-Content C:\scripts\keywords.txt
foreach ($line in $content) {

if ($line) {
(New-Object –ComObject SAPI.SPVoice).Speak(“Geting 50 links for $line”);
Write-Host -ForegroundColor Green "Geting 50 links for $line";
start-sleep 5
Invoke-RestMethod -uri "https://gdata.youtube.com/feeds/api/videos?v=2&q=$line-index=1&max-results=50" | foreach {[PSCustomObject]@{Title=$_.Title; Author=$_.author.name; Link=$_.content.src}} | Add-Content "c:\scripts\youtubelinks.txt"


 }
  }
Invoke-Item c:\scripts\youtubelinks.txt
Write-Host -ForegroundColor Green "CLEANING COMPLETE: Heres yourlinks master";
(New-Object –ComObject SAPI.SPVoice).Speak(“Here is all your you tube links master”);


Viewing all articles
Browse latest Browse all 6937

Trending Articles