今日Pocketでストックした記事を、「Title\nURL」形式で出力するだけのプログラム。
適当なブログとかに載せるとき向けに作成。
Pocket Developer Program: Pocket Authentication API: Documentation
今日Pocketでストックした記事を、「Title\nURL」形式で出力するだけのプログラム。
適当なブログとかに載せるとき向けに作成。
Pocket Developer Program: Pocket Authentication API: Documentation
| <?xml version="1.0" encoding="utf-8"?> | |
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |
| <PropertyGroup> | |
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
| <ProjectGuid>{84F6E212-CE4E-4322-8A1B-2F4CF0EA39BD}</ProjectGuid> | |
| <OutputType>Exe</OutputType> | |
| <AppDesignerFolder>Properties</AppDesignerFolder> | |
| <RootNamespace>DasaPocket</RootNamespace> | |
| <AssemblyName>DasaPocket</AssemblyName> | |
| <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | |
| <FileAlignment>512</FileAlignment> | |
| <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | |
| </PropertyGroup> | |
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |
| <PlatformTarget>AnyCPU</PlatformTarget> | |
| <DebugSymbols>true</DebugSymbols> | |
| <DebugType>full</DebugType> | |
| <Optimize>false</Optimize> | |
| <OutputPath>bin\Debug\</OutputPath> | |
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |
| <ErrorReport>prompt</ErrorReport> | |
| <WarningLevel>4</WarningLevel> | |
| </PropertyGroup> | |
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |
| <PlatformTarget>AnyCPU</PlatformTarget> | |
| <DebugType>pdbonly</DebugType> | |
| <Optimize>true</Optimize> | |
| <OutputPath>bin\Release\</OutputPath> | |
| <DefineConstants>TRACE</DefineConstants> | |
| <ErrorReport>prompt</ErrorReport> | |
| <WarningLevel>4</WarningLevel> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <Reference Include="Common.Logging, Version=2.1.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="ConfigR, Version=0.14.1.0, Culture=neutral, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ConfigR.0.14.1\lib\net45\ConfigR.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.Scripting.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.Scripting.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.Scripting.CSharp.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Microsoft.CodeAnalysis.Scripting.VisualBasic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\Microsoft.CodeAnalysis.Scripting.VisualBasic.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="PocketSharp, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\PocketSharp.4.2.0.0\lib\portable-net45+win+wpa81+wp80\PocketSharp.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="ScriptCs.Contracts, Version=0.16.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Contracts.0.16.1\lib\net45\ScriptCs.Contracts.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="ScriptCs.Core, Version=0.16.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Core.0.16.1\lib\net45\ScriptCs.Core.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="ScriptCs.Engine.Roslyn, Version=0.16.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\ScriptCs.Engine.Roslyn.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="System" /> | |
| <Reference Include="System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\System.Collections.Immutable.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="System.ComponentModel.Composition" /> | |
| <Reference Include="System.Core" /> | |
| <Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="System.Net.Http.WebRequest" /> | |
| <Reference Include="System.Reflection.Metadata, Version=1.0.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | |
| <HintPath>..\packages\ScriptCs.Engine.Roslyn.0.16.1\lib\net45\System.Reflection.Metadata.dll</HintPath> | |
| <Private>True</Private> | |
| </Reference> | |
| <Reference Include="System.Xml.Linq" /> | |
| <Reference Include="System.Data.DataSetExtensions" /> | |
| <Reference Include="Microsoft.CSharp" /> | |
| <Reference Include="System.Data" /> | |
| <Reference Include="System.Net.Http" /> | |
| <Reference Include="System.Xml" /> | |
| </ItemGroup> | |
| <ItemGroup> | |
| <Compile Include="Program.cs" /> | |
| <Compile Include="Properties\AssemblyInfo.cs" /> | |
| </ItemGroup> | |
| <ItemGroup> | |
| <None Include="App.config" /> | |
| <None Include="Config.csx.dummy" /> | |
| <None Include="Config.csx"> | |
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
| </None> | |
| <None Include="packages.config"> | |
| <SubType>Designer</SubType> | |
| </None> | |
| </ItemGroup> | |
| <ItemGroup> | |
| <Content Include="FodyWeavers.xml" /> | |
| </ItemGroup> | |
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |
| <Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" /> | |
| <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''"> | |
| <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" /> | |
| <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" /> | |
| </Target> | |
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |
| Other similar extension points exist, see Microsoft.Common.targets. | |
| <Target Name="BeforeBuild"> | |
| </Target> | |
| <Target Name="AfterBuild"> | |
| </Target> | |
| --> | |
| </Project> |
| using System; | |
| using ConfigR; | |
| using PocketSharp; | |
| using PocketSharp.Models; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Text; | |
| namespace DasaPocket | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Config.Global.LoadScriptFile("Config.csx"); | |
| PocketClient client = new PocketClient( | |
| Config.Global.Get<string>("ConsumerKey"), | |
| Config.Global.Get<string>("AccessToken") | |
| ); | |
| DateTime now = DateTime.Now; | |
| DateTime yesterday = new DateTime(now.Year, now.Month, now.Day); | |
| var articles = client.Get( | |
| since: yesterday, | |
| sort: Sort.oldest).Result; | |
| StringBuilder sb = new StringBuilder(); | |
| foreach(var article in articles) | |
| { | |
| sb.AppendLine(article.Title); | |
| sb.AppendLine(article.Uri.ToString()); | |
| sb.AppendLine(); | |
| } | |
| string outputPath = Config.Global.Get<string>("OutputPath"); | |
| using(TextWriter fs = new StreamWriter(outputPath, false)) | |
| { | |
| fs.Write(sb.ToString()); | |
| } | |
| } | |
| } | |
| } |