{"id":8422,"date":"2024-11-17T02:35:09","date_gmt":"2024-11-17T02:35:09","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=8422"},"modified":"2024-11-17T02:35:10","modified_gmt":"2024-11-17T02:35:10","slug":"powershell-to-search-for-people-who-have-cheaper-prices-then-you-on-ebay","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/powershell-to-search-for-people-who-have-cheaper-prices-then-you-on-ebay","title":{"rendered":"Powershell to Search for People who have cheaper prices then you on ebay"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.ebay.com.au\/sh\/reports\/downloads\">https:\/\/www.ebay.com.au\/sh\/reports\/downloads<\/a><\/p>\n\n\n\n<p>Export CSV<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\nimport-csv -Path C:\\Scripts\\eBay-all-active-listings-report-2024-11-13-11194153212.csv -Encoding UTF8 | ForEach {\n\n\n# URL to fetch the HTML\n$url = 'https:\/\/www.ebay.com.au\/sch\/i.html?_from=R40&amp;_nkw='+$_.Title+'&amp;_sacat=0&amp;_sop=15'\n\n# Fetch the HTML content\n$response = Invoke-WebRequest -Uri $url\n\n# Regex to find the &lt;span> with the specific class\n$regex = '&lt;span[^>]*class=[\"'']s-item__detail s-item__detail--secondary[\"''].*?>(.*?)&lt;\/span>'\nif ($response.Content -match $regex) {\n    $spanContent = $matches[1]  # Extract the content of the span\n\t\n\tif ($spanContent -like \"*username*\" -or $spanContent -like \"*NEGATIVE BOLD*\" -or $spanContent -like \"*ebay-plus*\") { \n}\nElse\n{\n\t$_.Title\n\t    Write-Output \"Content of the span: $spanContent\"\n\n}\n\t\n} else {\n    Write-Output \"No &lt;span> element with the specified class found.\"\n}\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.ebay.com.au\/sh\/reports\/downloads Export CSV<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8422","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=8422"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8422\/revisions"}],"predecessor-version":[{"id":8432,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8422\/revisions\/8432"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=8422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=8422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=8422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}