工作篇|用ChatGpt快速开发亚马逊工具

文摘   职场   2023-04-15 16:28   广东  
工作篇|用ChatGpt快速开发亚马逊工具

01
前题回顾
  b嗯问
     在发表"工作篇|用ChatGpt快速开发亚马逊工具"一文后,相信读者们已经对于用ChatGpt快速开发亚马逊工具有了初步的认识,也都会跃跃欲试,想要自己用ChatGpt快速开发亚马逊工具,本文继续分享出用ChatGpt快速开发运行于Tampermonkey的亚马逊工具。
    对用ChatGpt开发亚马逊工具的感兴趣的读者们可以转发分享本文后后台私信"用ChatGpt快速开发亚马逊工具"来一起共享、共创、头脑风暴更多的Idea哈!
    建议基础浅的观众可以先看之前第一篇发表的"工作篇|用ChatGpt快速开发亚马逊工具"一文后在回来观看此文。


02
优质文章阅读推荐
  b嗯问
能力进阶|学习财务思维的读后感
工作篇|探讨如何养成亚马逊选品基本功
工作篇|全面复盘亚马逊财税合规化


03
本文大纲
  
  • 一键式下载亚马逊商品的五点描述
  • 一键式复制展示权威链接
  • 一键式复制展示亚马逊页面视频链接(附上如何调教ChatGPT话术)
  • 一键式下载亚马逊商品的品牌名、五点描述、排名、ASIN、权威链接
  • 一键式查询亚马逊商品链接下所有变体的关键词排名


04
头脑风暴
  
  • 留作业:是否可以实现一键式查询亚马逊搜索结果页面下的广告ID和广告ASIN
  • 留作业:是否可以实现一键式下载亚马逊评论并输出分析报告
  • 留作业:是否可以实现一键式下载亚马逊图片
  • 留作业:是否可以实现一键式下载亚马逊QA
  • 留作业:是否可以实现一键式查询亚马逊商品的站外短链和网址


    这些留堂作业会在续篇免费分享给读者们,感兴趣的小伙伴们多多动动小手指点赞、转发分享、收藏叭!


05
一键式下载亚马逊商品的五点描述
  

    基于ChatGpt给出的整合建议实现了运行于Tampermonkey一键式下载亚马逊商品的五点描述的功能插件代码在前文已给出,一并记录此文,点击图文可跳转:


代码如下:

// ==UserScript==// @name         Amazon Scraper// @namespace    http://tampermonkey.net/// @version      1// @description  Scrape Amazon page bp and download as excel file// @author       lintonghui// @match        https://www.amazon.com/*// @grant        none// ==/UserScript==
(function() { 'use strict';
const description = Array.from(document.querySelectorAll('#feature-bullets span.a-list-item')).map(span => span.textContent.trim());
console.log(description);

const downloadExcel = (data) => { const blob = new Blob([data], {type: 'application/vnd.ms-excel'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'amazon_data.xls'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); };
const downloadButton = document.createElement('button'); downloadButton.innerText = 'Download Excel'; downloadButton.style.position = 'fixed'; downloadButton.style.top = '10px'; downloadButton.style.right = '10px'; downloadButton.addEventListener('click', () => { const data = [ [ 'Bullet Point'], ...description.map((description) => [description]) ].map(row => row.join('\t')).join('\n');


downloadExcel(data); });
document.body.appendChild(downloadButton);})();



06
一键式复制展示权威链接
  

    基于ChatGpt给出的整合建议实现了运行于Tampermonkey一键式复制展示权威链接,演示视频如下:

代码如下:

// ==UserScript==// @name         Find Amazon Canonical Link// @description  把权威链接添加展示到亚马逊标题节点的上方,且做到可复制Copy// @version      1// @author       lintonghui// @match        https://*.amazon.com/*// @match        https://*.amazon.co.uk/*// @match        https://*.amazon.co.de/*// @match        https://*.amazon.fr/*// @match        https://*.amazon.it/*// @match        https://*.amazon.es/*// @match        https://*.amazon.co.jp/*// @match        https://*.amazon.com.au/*// @match        https://*.amazon.sg/*// @grant        none// ==/UserScript==
(function() { 'use strict';
// Get the canonical link from the HTML code var link = document.querySelector('link[rel="canonical"]'); var url = link ? link.getAttribute('href') : null;
if (!url) { console.log('Canonical link not found!'); return; }
// Create a new container element for the canonical link var container = document.createElement('div'); container.style.fontWeight = 'bold'; container.style.marginBottom = '20px';
// Add the canonical link to the container element var linkText = document.createTextNode('canonical link: '); container.appendChild(linkText);
var linkSpan = document.createElement('span'); linkSpan.style.color = '#C65500'; linkSpan.innerText = url; container.appendChild(linkSpan);
// Create a new button to copy the canonical link to clipboard var button = document.createElement('button'); button.style.marginLeft = '10px'; button.innerText = 'Copy'; button.addEventListener('click', function() { var tempInput = document.createElement('input'); tempInput.value = url; document.body.appendChild(tempInput); tempInput.select(); document.execCommand('copy'); document.body.removeChild(tempInput); button.innerText = 'Copied!'; setTimeout(function() { button.innerText = 'Copy'; }, 1000); }); container.appendChild(button);
// Get the page title element var title = document.getElementById('productTitle');
// Insert the container element before the page title if (title) { title.parentNode.insertBefore(container, title); } else { console.log('Product title not found!'); }})();



07
一键式复制展示亚马逊页面视频链接
  

    基于ChatGpt给出的整合建议实现了运行于Tampermonkey一键式复制展示权威链接,演示视频如下:


代码如下:
// ==UserScript==// @name         Amazon 480p MP4 Link Crawler and Exporter// @namespace    amazon-480p-mp4-link-crawler-exporter// @version      1// @description  Crawl all 480p MP4 links on an Amazon product source page and display them on the page, with an option to export to Excel spreadsheet format (XLS) via a download button above the title. Note: The download button will be hidden if there are no 480p MP4 links found on the page.// @author       lintonghui// @match        https://*.amazon.com/*// @match        https://*.amazon.co.uk/*// @match        https://*.amazon.co.de/*// @match        https://*.amazon.fr/*// @match        https://*.amazon.it/*// @match        https://*.amazon.es/*// @match        https://*.amazon.co.jp/*// @match        https://*.amazon.com.au/*// @match        https://*.amazon.sg/*// @grant        none// ==/UserScript==
(function() { 'use strict';
const videoLinks = []; const source = document.documentElement.innerHTML; const regex = /"url":"([^"]+\.480\.mp4[^"]*)"/g;
let match; while ((match = regex.exec(source)) !== null) { videoLinks.push(match[1]); }
if (videoLinks.length > 0) { // Create div to hold links and download button const containerDiv = document.createElement('div'); containerDiv.style.display = 'flex'; containerDiv.style.alignItems = 'center'; containerDiv.style.justifyContent = 'space-between'; containerDiv.style.position = 'fixed'; containerDiv.style.top = '50px'; containerDiv.style.left = '50%'; containerDiv.style.transform = 'translateX(-50%)'; containerDiv.style.background = 'white'; containerDiv.style.padding = '10px'; containerDiv.style.borderRadius = '5px'; containerDiv.style.boxShadow = '0 2px 6px rgba(0,0,0,0.2)';
// Create div to hold links const linkDiv = document.createElement('div'); linkDiv.innerHTML = '<h3>Amazon 480p MP4 Links:</h3><ul>' + videoLinks.map(link => `<li><a href="${link}">${link}</a></li>`).join('') + '</ul>'; containerDiv.appendChild(linkDiv);
// Create download button const downloadButton = document.createElement('button'); downloadButton.innerText = 'Download as Excel Spreadsheet'; downloadButton.style.backgroundColor = '#f0c14b'; downloadButton.style.border = '1px solid #a88734'; downloadButton.style.borderRadius = '3px'; downloadButton.style.color = '#111'; downloadButton.style.fontWeight = 'bold'; downloadButton.style.cursor = 'pointer'; downloadButton.style.padding = '5px 10px'; downloadButton.style.marginLeft = '10px'; downloadButton.addEventListener('click', function() { const filename = 'amazon-480p-mp4-links.xls'; const csvHeaders = ['Link']; const csvData = videoLinks.map(link => [link]); let csv = csvHeaders.join(',') + '\n'; csv += csvData.map(row => row.join(',')).join('\n'); const blob = new Blob([csv], {type: 'application/vnd.ms-excel'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; a.click(); setTimeout(() => { URL.revokeObjectURL(url); }, 0); });
// Add download button to container div containerDiv.appendChild(downloadButton);
// Add container div to page document.body.insertBefore(containerDiv, document.body.firstChild); }})();

    为了让读者们更直观的明白如何调教ChatGpt,附上调教的指令,如下:

01 说出你想要让ChatGpt实现的需求
    最好是一开始用英文,并且可以给他参考链接

02 说出你想要让ChatGpt继续补充修改的需求


03 运行代码检验成果

    提一嘴为什么我这里不让ChatGpt用到XLSX、XLSX.utils代码,因为这个代码在Tampermonkey运行不起来,用 Blob 的 MIME 类型设置为 application/vnd.ms-excel发现才能运行成功输出为Excel表格。
    不得不说ChatGpt就像一个被压榨的甲方,任劳任怨的给出各种执行方案!


08
一键式下载亚马逊商品的内容信息
  

    一键式下载亚马逊商品的内容信息,包括亚马逊商品的品牌名、五点描述、排名、ASIN、权威链接,演示视频如下:


代码如下:

// ==UserScript==// @name         Extract Product Data and Export to Excel// @namespace    http://tampermonkey.net/// @version      1.0// @description  Extract product data from Amazon page and export to Excel using Tampermonkey script (without XLSX or XLSX.utils)// @author       lintonghui// @match        https://*.amazon.com/*// @match        https://*.amazon.co.uk/*// @match        https://*.amazon.co.de/*// @match        https://*.amazon.fr/*// @match        https://*.amazon.it/*// @match        https://*.amazon.es/*// @match        https://*.amazon.co.jp/*// @match        https://*.amazon.com.au/*// @match        https://*.amazon.sg/*// @grant        none// ==/UserScript==
(function() { 'use strict';
// 获取产品标题内容 const productTitle = document.getElementById("productTitle").innerText.trim();
// 获取功能列表内容 const featureBullets = document.getElementById("feature-bullets"); const featureList = featureBullets.querySelectorAll("ul.a-unordered-list > li > span.a-list-item"); const features = Array.from(featureList).map(item => item.innerText.trim());
// 获取排行榜信息 const rankList = document.querySelector("ul.zg_hrsr > li > span.a-list-item"); const rankInfo = rankList ? rankList.innerText.trim() : "";
// 获取品牌名称、ASIN和canonical链接 const brandInfo = document.querySelector("div#bylineInfo > .a-link-normal"); const brandName = brandInfo ? brandInfo.innerText.trim() : ""; const asinInfo = document.querySelector('input[name="ASIN"]'); const asin = asinInfo ? asinInfo.value : ""; const canonicalLink = document.querySelector('link[rel="canonical"]'); const canonicalUrl = canonicalLink ? canonicalLink.href : "";
// 创建一个按钮元素 const exportBtn = document.createElement("button"); exportBtn.textContent = "Export to Excel"; exportBtn.style.padding = "5px 10px"; exportBtn.style.margin = "10px";
// 将按钮添加到页面中,并绑定点击事件处理程序 document.body.prepend(exportBtn); exportBtn.addEventListener("click", () => { // 创建一个CSV格式的数据字符串 const csvData = `"Product Title","Features","Ranking Info","Brand Name","ASIN","CanonicalUrl"\n"${productTitle}","${features.join(",")}","${rankInfo}","${brandName}","${asin}","${canonicalUrl}"`;
// 创建一个<a>元素,设置下载属性并模拟点击 const downloadLink = document.createElement("a"); downloadLink.download = "product_data.csv"; downloadLink.href = `data:text/csv;charset=utf-8,${encodeURIComponent(csvData)}`; document.body.appendChild(downloadLink); downloadLink.click(); document.body.removeChild(downloadLink); });})();


    基于上方的代码如果想要继续实现批量ASIN下载信息呢?

// ==UserScript==// @name         Export to Excel// @namespace    http://tampermonkey.net/// @version      1.0// @description  Extract product data from Amazon search page and export to Excel using Tampermonkey script (without XLSX or XLSX.utils)// @author       lingtonghui// @match        https://*.amazon.com/*// @grant        none// ==/UserScript==
(function() { 'use strict';
// 判断当前是否为搜索结果页面 if (!window.location.href.includes("/s?k=") && !window.location.href.includes("/bestsellers")) { return; }
// 获取所有包含ASIN的链接元素 const asinLinks = document.querySelectorAll("a[href*='/dp/'], a[href*='/product/'], a[href*='/gp/product/']");
// 创建一个按钮元素 const exportBtn = document.createElement("button"); exportBtn.textContent = "Export to Excel"; exportBtn.style.padding = "5px 10px"; exportBtn.style.margin = "10px";
// 将按钮添加到页面中,并绑定点击事件处理程序 const resultsArea = document.getElementById("a-page"); resultsArea.parentNode.insertBefore(exportBtn, resultsArea); exportBtn.addEventListener("click", () => { const dataRows = [];
// 遍历所有包含ASIN的链接元素 asinLinks.forEach(link => { // 获取ASIN和canonical链接 const asin = link.href.match(/\/(dp|product)\/([A-Z0-9]+)/)[2]; const canonicalUrl = link.href;
// 获取品牌名称、功能列表、产品标题和排行榜信息 const productSection = link.closest("div[data-asin]"); const brandInfo = productSection.querySelector("div#bylineInfo > .a-link-normal"); const brandName = brandInfo ? brandInfo.innerText.trim() : ""; const featureBullets = productSection.querySelector("div#feature-bullets"); const featureList = featureBullets ? featureBullets.querySelectorAll("ul.a-unordered-list > li > span.a-list-item") : []; const features = Array.from(featureList).map(item => item.innerText.trim()); const productTitle = productSection.querySelector("h2 > a > span").innerText.trim(); const rankList = productSection.querySelector("span.zg-badge-text"); const rankInfo = rankList ? rankList.innerText.trim() : "";
// 将数据行添加到数组中 dataRows.push([brandName, asin, canonicalUrl, features.join(", "), productTitle, rankInfo]); });
// 创建一个CSV格式的数据字符串 const csvData = `"Brand Name","ASIN","CanonicalUrl","Features","Product Title","Ranking Info"\n${dataRows.map(row => `"${row.join('","')}"`).join("\n")}`;
// 创建一个<a>元素,设置下载属性并模拟点击 const downloadLink = document.createElement("a"); downloadLink.download = "product_data.csv"; downloadLink.href = `data:text/csv;charset=utf-8,${encodeURIComponent(csvData)}`; document.body.appendChild(downloadLink); downloadLink.click(); document.body.removeChild(downloadLink); });})();



09
一键式查询亚马逊商品关键词排名
  

    输入关键词可一键式查询链接下所有变体的亚马逊商品关键词排名,演示视频如下:

代码如下:
// ==UserScript==// @name         Amazon Keyword Rank Tracker UP!// @namespace    http://tampermonkey.net/// @version      1// @description  Track the realtime rank of keywords on Amazon product search 7page// @author       lintonghui// @match        https://*.amazon.com/*// @match        https://*.amazon.co.uk/*// @match        https://*.amazon.co.de/*// @match        https://*.amazon.fr/*// @match        https://*.amazon.it/*// @match        https://*.amazon.es/*// @match        https://*.amazon.co.jp/*// @match        https://*.amazon.com.au/*// @match        https://*.amazon.sg/*// @grant        GM_xmlhttpRequest// ==/UserScript==
(function() { 'use strict';
function getSearchPage(keywords, pageNumber, callback) { GM_xmlhttpRequest({ method: "GET", url: `https://www.amazon.com/s?k=${encodeURIComponent(keywords)}&page=${pageNumber}`, onload: function(response) { callback(response.responseText); } }); }
function checkProductRankInPage(html, asin) { const parser = new DOMParser(); const doc = parser.parseFromString(html, "text/html"); const searchResults = doc.querySelectorAll('.s-result-item');
for (let i = 0; i < searchResults.length; i++) { if (searchResults[i].getAttribute('data-asin') === asin) { return i + 1; } }
return -1; }
function createResultTable() { const table = document.createElement('table'); table.style.borderCollapse = 'collapse'; table.innerHTML = ` <thead style="display: none;"> <tr> <th style="border: 1px solid black; padding: 5px;">Keyword</th> <th style="border: 1px solid black; padding: 5px;">Page</th> <th style="border: 1px solid black; padding: 5px;">Rank</th> </tr> </thead> <tbody></tbody> `; return table; }
function addResultToTable(table, keyword, page, rank) { const row = document.createElement('tr'); row.innerHTML = ` <td style="border: 1px solid black; padding: 5px;">${keyword}</td> <td style="border: 1px solid black; padding: 5px;">${page}</td> <td style="border: 1px solid black; padding: 5px;">${rank}</td> `; table.querySelector('tbody').appendChild(row); table.querySelector('thead').style.display = 'table-header-group'; }
function clearResults(table) { table.querySelector('tbody').innerHTML = ''; table.querySelector('thead').style.display = 'none'; }
function trackKeywordRank(keywordsArray, asinList, maxPages) { const table = createResultTable(); const titleElement = document.querySelector('#titleSection'); titleElement.parentNode.insertBefore(table, titleElement);
keywordsArray.forEach((keywords) => { for (let i = 1; i <= maxPages; i++) { getSearchPage(keywords, i, function(html) { let rankFound = false; for (let j = 0; j < asinList.length; j++) { const rank = checkProductRankInPage(html, asinList[j]); if (rank !== -1) { addResultToTable(table, keywords, i, rank); rankFound = true; } } if (!rankFound) { addResultToTable(table, keywords, i, 'Not found'); } }); } }); }
function createKeywordInput() { const container = document.createElement('div'); container.innerHTML = ` <label for="keywordInput">Enter keywords (separated by ";"):</label> <input type="text" id="keywordInput" style="margin-left: 10px;"> <button id="searchButton" style="margin-left: 10px;">Search</button> `; return container; }
const asinRegex = /\/dp\/([A-Z0-9]{10})\//; const asinMatch = window.location.href.match(asinRegex); if (asinMatch) { const asin = asinMatch[1];
// Create keyword input and button const keywordInputContainer = createKeywordInput(); const titleElement = document.querySelector('#titleSection'); titleElement.parentNode.insertBefore(keywordInputContainer, titleElement);
// Create empty result table const table = createResultTable(); titleElement.parentNode.insertBefore(table, titleElement);
// Add click event listener to the search button const searchButton = document.querySelector('#searchButton'); searchButton.addEventListener('click', function() { const keywords = document.querySelector('#keywordInput').value; if (keywords) { // Clear existing results clearResults(table);
// Split keywords by ";" const keywordsArray = keywords.split(';').map(keyword => keyword.trim());
// Extract ASIN variations const asinVariations = Array.from(document.querySelectorAll('#variation_color_name li')) .map(variation => variation.getAttribute('data-defaultasin'));
// Add parent ASIN to variations asinVariations.unshift(asin);
// Track keyword ranks for all ASIN variations trackKeywordRank(keywordsArray, asinVariations, 7); } }); }})();




 ---优质广告合作服务商伙伴--

 ---持续招募优质广告合作服务商伙伴--



喜欢此内容的人还喜欢:

工作篇|用ChatGpt快速开发亚马逊工具

工作篇|亚马逊基本常识术语解释

能力进阶|学习财务思维的读后感
工作篇|亚马逊菜鸟运营的年终总结
工作篇|从亚马逊买家角度理解退货
工作篇|探讨如何养成亚马逊选品基本功
工作篇|记一个的函数综合运用
工作篇|别再因商品尺寸分段吃大亏
工作篇|亚马逊仓储中心的运作流程
工作篇|跨境财税合规化前置知识
工作篇|全面复盘亚马逊财税合规化
工作篇|跨境卖家专利布局指南
跨境电商采购人员思考复盘
工作篇|备战Prime Day广告策略
工作篇|亚马逊欧洲站点KYC过审指导
工作篇|亚马逊账号概述和注册流程
工作篇|开拓亚马逊企业购市场
工作篇|亚马逊产品流量结构分析
工作篇|备战亚马逊旺季行动指南
工作篇|亚马逊品牌所有者权益概览
工作篇|亚马逊关键词基本指导手册
工作篇|学习亚马逊品牌保护政策
工作篇|亚马逊广告基本指导手册
工作篇|别让侵权毁了亚马逊店铺
工作篇|亚马逊跨境物流基础知识扫盲
工作篇|保持亚马逊账户健康绩效
工作篇|分享70个实用亚马逊工具
工作篇|高效筛选亚马逊关键词
工作篇|合理给亚马逊产品定价
工作篇|受限商品政策下类目审核的流程
工作篇|在亚马逊上注册品牌和品牌授权
工作篇|提升亚马逊客户留评率
工作篇|搞懂商品编码的用途
工作篇|你真会用库存模板文件吗
工作篇|怎么应对账户二审和视频验证
工作篇|利用亚马逊联盟计划赚钱
工作篇|撰写合格的亚马逊POA
工作篇|深挖亚马逊A9算法背后的运营逻辑
工作篇|亚马逊客户服务拿捏着店铺的命脉
工作篇|亚马逊跟卖与反跟卖的矛与盾
工作篇|亚马逊账号关联与多账号操作技巧
工作篇|复盘常见的亚马逊0元购场景
工作篇| 运营电商平台的第一步你可别踩坑了
工作篇| 亚马逊菜鸟运营的年终总结

写给每一位追梦的人




扫码关注



排版丨林子酱

文案丨林子酱

摄像丨林子酱



我明白你会来,所以我等

点个在看、点赞再走吧

掘金跨境
以学习旅行家的身份去分享生活趣事、跨境行业热点
 最新文章